Class: SmartHash::Loose

Inherits:
SmartHash show all
Defined in:
lib/smart_hash/loose.rb

Overview

Non-strict SmartHash

person = SmartHash::Loose[]

is equivalent to:

person = SmartHash[]
person.strict = false

Constant Summary

Constants inherited from SmartHash

ATTR_REGEXP, FORBIDDEN_ATTRS, VERSION

Instance Attribute Summary

Attributes inherited from SmartHash

#declared_attrs, #protected_attrs, #strict

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from SmartHash

#declare, #protect, #undeclare, #unprotect

Constructor Details

#initialize(*args) ⇒ Loose

See SmartHash#initialize.



14
15
16
17
# File 'lib/smart_hash/loose.rb', line 14

def initialize(*args)
  super
  @strict = false
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class SmartHash

Class Method Details

.[](*args) ⇒ Object

See SmartHash::[].



20
21
22
23
24
# File 'lib/smart_hash/loose.rb', line 20

def self.[](*args)
  super.tap do |_|
    _.strict = false
  end
end