Class: Morecane::EncodingCheck

Inherits:
Struct
  • Object
show all
Defined in:
lib/morecane/encoding_check.rb

Overview

Creates violations for ruby files that have no encoding marker in the first two lines

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#optsObject

Returns the value of attribute opts

Returns:

  • (Object)

    the current value of opts



6
7
8
# File 'lib/morecane/encoding_check.rb', line 6

def opts
  @opts
end

Class Method Details

.optionsObject



7
8
9
10
11
12
13
14
# File 'lib/morecane/encoding_check.rb', line 7

def self.options
  {
    encoding_glob: ['Glob to run encoding checks over',
                        default:  '{app,lib,spec}/**/*.rb',
                        variable: 'GLOB',
                        clobber:  :no_encoding]
  }
end

Instance Method Details

#violationsObject



16
17
18
19
20
# File 'lib/morecane/encoding_check.rb', line 16

def violations
  file_names.map { |file_name|
    find_violations(file_name)
  }.flatten.compact
end