Class: TypedAttributes::Parser::BaseType
- Inherits:
-
Object
- Object
- TypedAttributes::Parser::BaseType
- Defined in:
- lib/typed_attributes/parser/base_type.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#attribute ⇒ Object
readonly
Returns the value of attribute attribute.
-
#model ⇒ Object
readonly
Returns the value of attribute model.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(model, attr, options = {}) ⇒ BaseType
constructor
A new instance of BaseType.
- #parse(value) ⇒ Object
- #readers ⇒ Object
- #storage_var ⇒ Object
- #writers ⇒ Object
Constructor Details
#initialize(model, attr, options = {}) ⇒ BaseType
Returns a new instance of BaseType.
7 8 9 10 11 |
# File 'lib/typed_attributes/parser/base_type.rb', line 7 def initialize(model, attr, = {}) @model = model @attribute = attr @options = || {} end |
Instance Attribute Details
#attribute ⇒ Object (readonly)
Returns the value of attribute attribute.
5 6 7 |
# File 'lib/typed_attributes/parser/base_type.rb', line 5 def attribute @attribute end |
#model ⇒ Object (readonly)
Returns the value of attribute model.
5 6 7 |
# File 'lib/typed_attributes/parser/base_type.rb', line 5 def model @model end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'lib/typed_attributes/parser/base_type.rb', line 5 def @options end |
Instance Method Details
#parse(value) ⇒ Object
13 14 15 |
# File 'lib/typed_attributes/parser/base_type.rb', line 13 def parse(value) raise NotImplementedError.new end |
#readers ⇒ Object
21 22 23 |
# File 'lib/typed_attributes/parser/base_type.rb', line 21 def readers [attribute] end |
#storage_var ⇒ Object
17 18 19 |
# File 'lib/typed_attributes/parser/base_type.rb', line 17 def storage_var :"@#{attribute}" end |
#writers ⇒ Object
25 26 27 |
# File 'lib/typed_attributes/parser/base_type.rb', line 25 def writers [:"#{attribute}="] end |