Class: HashieMashKnockoff

Inherits:
Object
  • Object
show all
Defined in:
lib/hashie_mash_knockoff.rb,
lib/hashie_mash_knockoff/version.rb,
lib/hashie_mash_knockoff/add_default_values.rb,
lib/hashie_mash_knockoff/add_instance_methods.rb

Defined Under Namespace

Classes: AddDefaultValues, AddInstanceMethods

Constant Summary collapse

VERSION =
'0.4.3'

Instance Method Summary collapse

Constructor Details

#initialize(kwargs = {}, defaults = {}) ⇒ HashieMashKnockoff

Returns a new instance of HashieMashKnockoff.



8
9
10
11
# File 'lib/hashie_mash_knockoff.rb', line 8

def initialize(kwargs = {}, defaults = {})
  @hash = AddDefaultValues.new.add(kwargs, defaults)
  decorate_self(self, @hash)
end

Instance Method Details

#[](key) ⇒ Object



13
14
15
# File 'lib/hashie_mash_knockoff.rb', line 13

def [](key)
  @hash[key]
end

#to_hashObject Also known as: to_h



17
18
19
# File 'lib/hashie_mash_knockoff.rb', line 17

def to_hash
  @hash
end

#to_jsonObject



21
22
23
# File 'lib/hashie_mash_knockoff.rb', line 21

def to_json
  to_hash.to_json
end