Class: BB::Relation

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/b_b/relation.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRelation



6
7
8
# File 'lib/b_b/relation.rb', line 6

def initialize
  @builder = Builder.new
end

Instance Attribute Details

#builderObject (readonly)

Returns the value of attribute builder.



4
5
6
# File 'lib/b_b/relation.rb', line 4

def builder
  @builder
end

Instance Method Details

#andObject



29
30
31
# File 'lib/b_b/relation.rb', line 29

def and
  tap { builder.options[:operator] = "AND" }
end

#notObject



37
38
39
# File 'lib/b_b/relation.rb', line 37

def not
  tap { builder.options[:negation] = true }
end

#offset(offset) ⇒ Object



45
46
47
# File 'lib/b_b/relation.rb', line 45

def offset(offset)
  tap { builder.add_offset_to_limit(offset) }
end

#on(rel) ⇒ Object



41
42
43
# File 'lib/b_b/relation.rb', line 41

def on(rel)
  tap { builder.add_option_to_just_before_join(rel) }
end

#orObject



33
34
35
# File 'lib/b_b/relation.rb', line 33

def or
  tap { builder.options[:operator] = "OR" }
end