Sha256: 4ae15572126976492918ccae53b37a9fd237c40a49ac72ec09efbf92d9a17fca
Contents?: true
Size: 956 Bytes
Versions: 5
Compression:
Stored size: 956 Bytes
Contents
require "yaml" require "cascade/exceptions" require "cascade/helpers/configuration" module Cascade class ColumnsMatching extend Forwardable extend Configuration define_setting :mapping_file def_delegator :supported_keys, :index def initialize(options = {}) @filepath = options[:filepath] @content = options.fetch(:content) { parse_content_file } end # Defines set of possible keys that can be used for iterating through # parsed line # # @return [Array] of supported keys def supported_keys @supported_keys ||= @content.keys end # Presenter for passed key # # @return [Symbol] with curresponding value def column_type(key) @content[key].to_sym end private def parse_content_file content = YAML.load_file(@filepath || self.class.mapping_file) (content && content["mapping"]) || raise(Cascade::WrongMappingFormat.new) end end end
Version data entries
5 entries across 5 versions & 1 rubygems