Class: MaybeHash
- Inherits:
-
Object
- Object
- MaybeHash
- Defined in:
- lib/maybe_hash.rb,
lib/maybe_hash/version.rb
Constant Summary collapse
- VERSION =
"0.1.0"
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(value) ⇒ MaybeHash
constructor
A new instance of MaybeHash.
- #method_missing(attribute) ⇒ Object
Constructor Details
#initialize(value) ⇒ MaybeHash
Returns a new instance of MaybeHash.
7 8 9 |
# File 'lib/maybe_hash.rb', line 7 def initialize(value) @value = value end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(attribute) ⇒ Object
11 12 13 |
# File 'lib/maybe_hash.rb', line 11 def method_missing(attribute) self.class.new(choose_value(attribute)) end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
5 6 7 |
# File 'lib/maybe_hash.rb', line 5 def value @value end |