class Object

Constants

ADDED_OR_MODIFIED

Public Instance Methods

extract_file_name(file_name_with_status) click to toggle source
# File lib/generators/tablexi_dev/git_hook_generator/files/rubocop-pre-commit, line 13
def extract_file_name(file_name_with_status)
  file_name_array = file_name_with_status.strip.split(" ")
  file_name_array.shift
  fname = file_name_array.join(" ")
  fname[0] = "" if fname[0] == '"'
  fname[fname.length - 1] = "" if fname[fname.length - 1] == '"'
  raise_single_quote_error if fname.include?("'")
  fname
end
raise_single_quote_error() click to toggle source

to prevent code injection: system is a dangerous call

# File lib/generators/tablexi_dev/git_hook_generator/files/rubocop-pre-commit, line 9
def raise_single_quote_error
  raise ArgumentError, "Single quotes are not allowed in filenames here."
end