Class: BB::Relation
- Inherits:
-
Object
- Object
- BB::Relation
- Extended by:
- Forwardable
- Defined in:
- lib/b_b/relation.rb
Instance Attribute Summary collapse
-
#builder ⇒ Object
readonly
Returns the value of attribute builder.
Instance Method Summary collapse
- #and ⇒ Object
-
#initialize ⇒ Relation
constructor
A new instance of Relation.
- #not ⇒ Object
- #offset(offset) ⇒ Object
- #on(rel) ⇒ Object
- #or ⇒ Object
Constructor Details
#initialize ⇒ Relation
6 7 8 |
# File 'lib/b_b/relation.rb', line 6 def initialize @builder = Builder.new end |
Instance Attribute Details
#builder ⇒ Object (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
#and ⇒ Object
29 30 31 |
# File 'lib/b_b/relation.rb', line 29 def and tap { builder.[:operator] = "AND" } end |
#not ⇒ Object
37 38 39 |
# File 'lib/b_b/relation.rb', line 37 def not tap { builder.[: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 |
#or ⇒ Object
33 34 35 |
# File 'lib/b_b/relation.rb', line 33 def or tap { builder.[:operator] = "OR" } end |