Class: Mongery::Builder
- Inherits:
-
Object
- Object
- Mongery::Builder
- Defined in:
- lib/mongery.rb
Instance Attribute Summary collapse
-
#custom_operators ⇒ Object
Returns the value of attribute custom_operators.
-
#mapped_properties ⇒ Object
Returns the value of attribute mapped_properties.
-
#model ⇒ Object
readonly
Returns the value of attribute model.
-
#schema ⇒ Object
readonly
Returns the value of attribute schema.
-
#table ⇒ Object
readonly
Returns the value of attribute table.
Instance Method Summary collapse
- #count(*args) ⇒ Object
- #find(*args) ⇒ Object
- #index(*args) ⇒ Object
-
#initialize(model, engine = ActiveRecord::Base, schema = nil) ⇒ Builder
constructor
A new instance of Builder.
- #insert(*args) ⇒ Object
Constructor Details
#initialize(model, engine = ActiveRecord::Base, schema = nil) ⇒ Builder
Returns a new instance of Builder.
10 11 12 13 14 15 16 |
# File 'lib/mongery.rb', line 10 def initialize(model, engine = ActiveRecord::Base, schema = nil) @model = model @table = Arel::Table.new(model, engine) @schema = Schema.new(schema) if schema @mapped_properties = {} @custom_operators = {} end |
Instance Attribute Details
#custom_operators ⇒ Object
Returns the value of attribute custom_operators.
8 9 10 |
# File 'lib/mongery.rb', line 8 def custom_operators @custom_operators end |
#mapped_properties ⇒ Object
Returns the value of attribute mapped_properties.
7 8 9 |
# File 'lib/mongery.rb', line 7 def mapped_properties @mapped_properties end |
#model ⇒ Object (readonly)
Returns the value of attribute model.
7 8 9 |
# File 'lib/mongery.rb', line 7 def model @model end |
#schema ⇒ Object (readonly)
Returns the value of attribute schema.
7 8 9 |
# File 'lib/mongery.rb', line 7 def schema @schema end |
#table ⇒ Object (readonly)
Returns the value of attribute table.
7 8 9 |
# File 'lib/mongery.rb', line 7 def table @table end |
Instance Method Details
#count(*args) ⇒ Object
31 32 33 |
# File 'lib/mongery.rb', line 31 def count(*args) build_query.where(*args).count end |
#find(*args) ⇒ Object
27 28 29 |
# File 'lib/mongery.rb', line 27 def find(*args) build_query.where(*args) end |
#index(*args) ⇒ Object
39 40 41 |
# File 'lib/mongery.rb', line 39 def index(*args) build_query.index(*args) end |
#insert(*args) ⇒ Object
35 36 37 |
# File 'lib/mongery.rb', line 35 def insert(*args) build_query.insert(*args) end |