Module: ArcWeld::Relationship
- Defined in:
- lib/arc_weld/relationship.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(klass) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/arc_weld/relationship.rb', line 14 def self.included(klass) klass.class_eval '@@RELATIONSHIPS = []' klass.class_eval do extend ClassMethods end end |
Instance Method Details
#relationship_hash ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/arc_weld/relationship.rb', line 26 def relationship_hash relationship_types.reduce({}) do |memo, key| meth = format('%s_relationship',key) if self.send(meth).nil? memo else memo.merge(self.send(meth)) end end end |
#relationship_types ⇒ Object
22 23 24 |
# File 'lib/arc_weld/relationship.rb', line 22 def relationship_types self.class.class_variable_get :@@RELATIONSHIPS end |