Module: Hash19::Core

Extended by:
ActiveSupport::Concern
Includes:
Resolvers
Included in:
Hash19
Defined in:
lib/hash19/core.rb

Defined Under Namespace

Modules: ClassMethods, Initializer

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Resolvers

#resolve_aliases, #resolve_associations, #resolve_class, #resolve_has_many, #resolve_has_one, #resolve_injections, #resolve_transformers

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *args, &block) ⇒ Object



35
36
37
38
39
40
41
# File 'lib/hash19/core.rb', line 35

def method_missing(m, *args, &block)  
  if @hash19.respond_to? m
    @hash19.send(m, *args, &block)
  else
    super
  end
end

Class Method Details

.included(klass) ⇒ Object



31
32
33
# File 'lib/hash19/core.rb', line 31

def self.included(klass)
  klass.send :prepend, Initializer
end

Instance Method Details

#to_h(lazy = false) ⇒ Object



43
44
45
46
47
48
49
50
# File 'lib/hash19/core.rb', line 43

def to_h(lazy=false)
  return @hash19 if lazy
  if @hash19.is_a? Array
    @hash19.map { |hash| traverse_hash(hash) }
  else
    traverse_hash(@hash19)
  end
end