Class: ROM::Mapper::Attribute
- Inherits:
-
Struct
- Object
- Struct
- ROM::Mapper::Attribute
- Includes:
- Adamantium
- Defined in:
- lib/rom/mapper/attribute.rb
Overview
Represents a mapping attribute
Instance Attribute Summary collapse
-
#field ⇒ Object
Returns the value of attribute field.
-
#name ⇒ Object
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
- #mapping ⇒ Object private
- #tuple_key ⇒ Object private
Instance Attribute Details
#field ⇒ Object
Returns the value of attribute field
9 10 11 |
# File 'lib/rom/mapper/attribute.rb', line 9 def field @field end |
#name ⇒ Object
Returns the value of attribute name
9 10 11 |
# File 'lib/rom/mapper/attribute.rb', line 9 def name @name end |
Class Method Details
.coerce(input, mapping = nil) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
13 14 15 16 |
# File 'lib/rom/mapper/attribute.rb', line 13 def self.coerce(input, mapping = nil) field = Axiom::Attribute.coerce(input) new(mapping || field.name, field) end |
Instance Method Details
#mapping ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
19 20 21 |
# File 'lib/rom/mapper/attribute.rb', line 19 def mapping { tuple_key => name } end |
#tuple_key ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
24 25 26 |
# File 'lib/rom/mapper/attribute.rb', line 24 def tuple_key field.name end |