Class: Cascade::ColumnsMatching

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/cascade/columns_matching.rb

Constant Summary collapse

ROOT_KEY =
'mapping'

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ ColumnsMatching

Returns a new instance of ColumnsMatching.



15
16
17
18
19
# File 'lib/cascade/columns_matching.rb', line 15

def initialize(options = {})
  @content = options.fetch(:content) do
    parse_content_file(options.fetch(:filepath))
  end
end

Instance Method Details

#column_type(key) ⇒ Symbol

Presenter for passed key

Returns:

  • (Symbol)

    with the corresponding value



32
33
34
# File 'lib/cascade/columns_matching.rb', line 32

def column_type(key)
  @content[key].to_sym
end

#supported_keysArray

Defines set of possible keys that can be used for iterating through the parsed line

Returns:

  • (Array)

    of the supported keys



25
26
27
# File 'lib/cascade/columns_matching.rb', line 25

def supported_keys
  @supported_keys ||= @content.keys
end