Class: ArelHelpers::QueryBuilder
- Inherits:
-
Object
- Object
- ArelHelpers::QueryBuilder
- Extended by:
- Forwardable
- Includes:
- Enumerable
- Defined in:
- lib/arel-helpers/query_builder.rb
Constant Summary collapse
- TERMINAL_METHODS =
[:count, :first, :last]
Instance Attribute Summary collapse
-
#query ⇒ Object
readonly
Returns the value of attribute query.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(query) ⇒ QueryBuilder
constructor
A new instance of QueryBuilder.
Constructor Details
#initialize(query) ⇒ QueryBuilder
Returns a new instance of QueryBuilder.
34 35 36 |
# File 'lib/arel-helpers/query_builder.rb', line 34 def initialize(query) @query = query end |
Instance Attribute Details
#query ⇒ Object (readonly)
Returns the value of attribute query.
11 12 13 |
# File 'lib/arel-helpers/query_builder.rb', line 11 def query @query end |
Class Method Details
.not_nil(name) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/arel-helpers/query_builder.rb', line 19 def self.not_nil(name) mod = Module.new do define_method(name) do |*args, **kwargs| if (value = super(*args, **kwargs)) value else reflect(query) end end end prepend mod name end |