Class: ActiveRecordNestedScope::Builder

Inherits:
Object
  • Object
show all
Defined in:
lib/activerecord_nested_scope/builder.rb

Instance Method Summary collapse

Constructor Details

#initialize(klass, name, args) ⇒ Builder

Returns a new instance of Builder.



3
4
5
6
7
# File 'lib/activerecord_nested_scope/builder.rb', line 3

def initialize(klass, name, args)
  @node = Node.new(klass, name)
  @args = args
  @args_type = args_type(args)
end

Instance Method Details

#build(node = @node) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/activerecord_nested_scope/builder.rb', line 9

def build(node = @node)
  if node.leaf?
    leaf_relation(node)
  else
    build_relation(node)
  end
end