Sha256: 92e356e94100ac362b33af51cfd8d2368ef018eb53945d03b96298bc3106d430

Contents?: true

Size: 857 Bytes

Versions: 7

Compression:

Stored size: 857 Bytes

Contents

module Decanter
  module ValueParser
    @@value_parsers = {}

    def self.register(value_parser)
      @@value_parsers[value_parser.name.demodulize] = value_parser
    end

    def self.value_parser_for(sym)
      @@value_parsers["#{sym.to_s.camelize}Parser"] || (raise NameError.new("unknown value parser #{sym.to_s.capitalize}Parser"))
    end
  end
end

require_relative 'value_parser/base'
require_relative 'value_parser/core'
require_relative 'value_parser/boolean_parser'
require_relative 'value_parser/date_parser'
require_relative 'value_parser/datetime_parser'
require_relative 'value_parser/string_parser'
require_relative 'value_parser/phone_parser'
require_relative 'value_parser/float_parser'
require_relative 'value_parser/integer_parser'
require_relative 'value_parser/key_value_splitter_parser'
require_relative 'value_parser/join_parser'

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
decanter-0.7.1 lib/decanter/value_parser.rb
decanter-0.7.0 lib/decanter/value_parser.rb
decanter-0.6.3 lib/decanter/value_parser.rb
decanter-0.6.2 lib/decanter/value_parser.rb
decanter-0.6.1 lib/decanter/value_parser.rb
decanter-0.6.0 lib/decanter/value_parser.rb
decanter-0.5.5 lib/decanter/value_parser.rb