Class: ActsInRelation::Core::Relation

Inherits:
Object
  • Object
show all
Defined in:
lib/acts_in_relation/core.rb

Instance Method Summary collapse

Constructor Details

#initialize(position, params, class_name) ⇒ Relation

Returns a new instance of Relation.



22
23
24
25
26
# File 'lib/acts_in_relation/core.rb', line 22

def initialize(position, params, class_name)
  @position   = position
  @params     = params
  @class_name = class_name
end

Instance Method Details

#defineObject



28
29
30
31
32
33
34
# File 'lib/acts_in_relation/core.rb', line 28

def define
  positions = (@position == :self) ? [:source, :target] : [@position]
  positions.each do |position|
    extend "ActsInRelation::#{position.capitalize}".constantize
    define
  end
end