class Cascade::ColumnsMatching

Constants

ROOT_KEY

Public Class Methods

new(options = {}) click to toggle source
# File lib/cascade/columns_matching.rb, line 15
def initialize(options = {})
  @content = options.fetch(:content) do
    parse_content_file(options.fetch(:filepath))
  end
end

Public Instance Methods

column_type(key) click to toggle source

Presenter for passed key

@return [Symbol] with the corresponding value

# File lib/cascade/columns_matching.rb, line 32
def column_type(key)
  @content[key].to_sym
end
supported_keys() click to toggle source

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

@return [Array] of the supported keys

# File lib/cascade/columns_matching.rb, line 25
def supported_keys
  @supported_keys ||= @content.keys
end

Private Instance Methods

parse_content_file(filepath) click to toggle source
# File lib/cascade/columns_matching.rb, line 38
def parse_content_file(filepath)
  content = YAML.load_file(filepath)
  (content && content[ROOT_KEY]) || raise(Cascade::WrongMappingFormat)
end