Class: Stannum::Attribute::Builder
- Inherits:
-
Object
- Object
- Stannum::Attribute::Builder
- Defined in:
- lib/stannum/attribute.rb
Overview
Builder class for defining attribute methods on an entity.
Instance Attribute Summary collapse
-
#schema ⇒ Stannum::Schema
readonly
The attributes schema on which to define methods.
Instance Method Summary collapse
-
#call(attribute) ⇒ Object
Defines the reader and writer methods for the attribute.
-
#initialize(schema) ⇒ Builder
constructor
A new instance of Builder.
Constructor Details
#initialize(schema) ⇒ Builder
Returns a new instance of Builder.
15 16 17 |
# File 'lib/stannum/attribute.rb', line 15 def initialize(schema) @schema = schema end |
Instance Attribute Details
#schema ⇒ Stannum::Schema (readonly)
Returns the attributes schema on which to define methods.
21 22 23 |
# File 'lib/stannum/attribute.rb', line 21 def schema @schema end |
Instance Method Details
#call(attribute) ⇒ Object
Defines the reader and writer methods for the attribute.
26 27 28 29 |
# File 'lib/stannum/attribute.rb', line 26 def call(attribute) define_reader(attribute) define_writer(attribute) end |