Class: MultipleMan::Identity::MultipleField
- Inherits:
-
MultipleMan::Identity
- Object
- MultipleMan::Identity
- MultipleMan::Identity::MultipleField
- Defined in:
- lib/multiple_man/identity.rb
Instance Attribute Summary collapse
-
#identify_by ⇒ Object
Returns the value of attribute identify_by.
Attributes inherited from MultipleMan::Identity
Instance Method Summary collapse
-
#initialize(record, identify_by) ⇒ MultipleField
constructor
A new instance of MultipleField.
- #value ⇒ Object
Methods inherited from MultipleMan::Identity
Constructor Details
#initialize(record, identify_by) ⇒ MultipleField
Returns a new instance of MultipleField.
18 19 20 21 |
# File 'lib/multiple_man/identity.rb', line 18 def initialize(record, identify_by) self.identify_by = identify_by ? [*identify_by] : [:id] super(record) end |
Instance Attribute Details
#identify_by ⇒ Object
Returns the value of attribute identify_by.
28 29 30 |
# File 'lib/multiple_man/identity.rb', line 28 def identify_by @identify_by end |
Instance Method Details
#value ⇒ Object
22 23 24 25 26 |
# File 'lib/multiple_man/identity.rb', line 22 def value Hash[identify_by.map do |field| [field, record.send(field)] end] end |