Class: RailsClafer::Association
- Inherits:
-
Object
- Object
- RailsClafer::Association
- Defined in:
- lib/rails_clafer/association.rb
Instance Attribute Summary collapse
-
#dst ⇒ Object
Returns the value of attribute dst.
-
#dst_card ⇒ Object
Returns the value of attribute dst_card.
-
#ref_name ⇒ Object
Returns the value of attribute ref_name.
-
#src ⇒ Object
Returns the value of attribute src.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(src, dst, dst_card) ⇒ Association
constructor
A new instance of Association.
Constructor Details
#initialize(src, dst, dst_card) ⇒ Association
Returns a new instance of Association.
13 14 15 |
# File 'lib/rails_clafer/association.rb', line 13 def initialize(src, dst, dst_card) @src, @dst, @dst_card = src, dst, dst_card end |
Instance Attribute Details
#dst ⇒ Object
Returns the value of attribute dst.
12 13 14 |
# File 'lib/rails_clafer/association.rb', line 12 def dst @dst end |
#dst_card ⇒ Object
Returns the value of attribute dst_card.
12 13 14 |
# File 'lib/rails_clafer/association.rb', line 12 def dst_card @dst_card end |
#ref_name ⇒ Object
Returns the value of attribute ref_name.
12 13 14 |
# File 'lib/rails_clafer/association.rb', line 12 def ref_name @ref_name end |
#src ⇒ Object
Returns the value of attribute src.
12 13 14 |
# File 'lib/rails_clafer/association.rb', line 12 def src @src end |
Class Method Details
.from_ar_assoc(src_class, ar_assoc) ⇒ Object
4 5 6 7 8 9 10 |
# File 'lib/rails_clafer/association.rb', line 4 def from_ar_assoc(src_class, ar_assoc) card = Card.from_ar_assoc ar_assoc assoc = new ClaferModel.claferize_name(src_class.name), ClaferModel.claferize_name(ar_assoc.klass.name), card assoc.ref_name = ClaferModel.claferize_name ar_assoc.name if ar_assoc.name assoc end |