Class: Cane::HashCheck

Inherits:
Struct
  • Object
show all
Defined in:
lib/cane/hashcheck/hash_check.rb

Constant Summary collapse

DESCRIPTION =
'Ruby 1.9 hash syntax violation'
DEFAULT_GLOB =
'{app,lib}/**/*.rb'

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#optionsObject

Returns the value of attribute options

Returns:

  • (Object)

    the current value of options



4
5
6
# File 'lib/cane/hashcheck/hash_check.rb', line 4

def options
  @options
end

Class Method Details

.keyObject



9
# File 'lib/cane/hashcheck/hash_check.rb', line 9

def self.key; :hash; end

.nameObject



10
# File 'lib/cane/hashcheck/hash_check.rb', line 10

def self.name; 'Hash check'; end

.optionsObject



11
12
13
14
15
16
17
18
19
# File 'lib/cane/hashcheck/hash_check.rb', line 11

def self.options
  {
    hash_glob: [
      'File glob to run hash checks over',
      default: DEFAULT_GLOB,
      clobber: :no_hash
    ]
  }
end

Instance Method Details

#violationsObject



21
22
23
24
25
26
27
28
29
# File 'lib/cane/hashcheck/hash_check.rb', line 21

def violations
  [].tap do |violations|
    unless options[:no_hash]
      each_violation do |file_name, line_number|
        violations << new_violation(file_name, line_number)
      end
    end
  end
end