module ParsableHash::InstanceMethods
Public Instance Methods
parse_hash(object, options = {})
click to toggle source
# File lib/parsable_hash.rb, line 19 def parse_hash(object, options = {}) parse_with_strategy(object, options[:with], options[:const]) end
Private Instance Methods
parse_strategies()
click to toggle source
# File lib/parsable_hash.rb, line 35 def parse_strategies self.class.parse_strategies end
parse_with_strategy(hash, strategy, const = nil)
click to toggle source
# File lib/parsable_hash.rb, line 25 def parse_with_strategy(hash, strategy, const = nil) if const && const.is_a?(Module) raise NotDefinedError.new unless const.include?(ParsableHash) Parser.new(hash, const.parse_strategies[strategy]).call else Parser.new(hash, parse_strategies[strategy]).call end end