Module: Traits::Association::Members
- Included in:
- Traits::Association
- Defined in:
- lib/traits/association/members.rb
Instance Method Summary collapse
- #from ⇒ Object
-
#from_class ⇒ Object
Returns the actual association establisher class.
- #self_to_self? ⇒ Boolean
-
#to ⇒ Object
Returns the actual associated class.
- #to_class ⇒ Object
- #to_hash ⇒ Object
Instance Method Details
#from ⇒ Object
7 8 9 |
# File 'lib/traits/association/members.rb', line 7 def from @from_class.traits end |
#from_class ⇒ Object
Returns the actual association establisher class
12 13 14 |
# File 'lib/traits/association/members.rb', line 12 def from_class @from_class end |
#self_to_self? ⇒ Boolean
25 26 27 |
# File 'lib/traits/association/members.rb', line 25 def self_to_self? from_class == to_class end |
#to ⇒ Object
Returns the actual associated class
17 18 19 |
# File 'lib/traits/association/members.rb', line 17 def to reflection.klass.traits unless polymorphic? end |
#to_class ⇒ Object
21 22 23 |
# File 'lib/traits/association/members.rb', line 21 def to_class reflection.klass unless polymorphic? end |
#to_hash ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/traits/association/members.rb', line 29 def to_hash super.merge!( from: from.name, to: to.try(:name), self_to_self: self_to_self? ) end |