Class: Hahamut::Attribute::Base
- Inherits:
-
Object
- Object
- Hahamut::Attribute::Base
- Defined in:
- lib/hahamut/attribute/base.rb
Overview
Base value
Instance Attribute Summary collapse
-
#before_cast ⇒ Object
readonly
Returns the value of attribute before_cast.
Instance Method Summary collapse
- #as_json ⇒ Object
-
#initialize(value) ⇒ Base
constructor
A new instance of Base.
- #to_json(_obj = nil) ⇒ Object
- #value ⇒ Object
Constructor Details
#initialize(value) ⇒ Base
Returns a new instance of Base.
9 10 11 |
# File 'lib/hahamut/attribute/base.rb', line 9 def initialize(value) @before_cast = value end |
Instance Attribute Details
#before_cast ⇒ Object (readonly)
Returns the value of attribute before_cast.
7 8 9 |
# File 'lib/hahamut/attribute/base.rb', line 7 def before_cast @before_cast end |
Instance Method Details
#as_json ⇒ Object
17 18 19 |
# File 'lib/hahamut/attribute/base.rb', line 17 def as_json value end |
#to_json(_obj = nil) ⇒ Object
21 22 23 |
# File 'lib/hahamut/attribute/base.rb', line 21 def to_json(_obj = nil) as_json.to_json end |
#value ⇒ Object
13 14 15 |
# File 'lib/hahamut/attribute/base.rb', line 13 def value @value ||= before_cast end |