Module: Mongorm::Repository::ClassMethods
- Defined in:
- lib/mongorm/repository/class_methods.rb
Instance Attribute Summary collapse
-
#mapping ⇒ Object
readonly
Returns the value of attribute mapping.
Instance Method Summary collapse
Instance Attribute Details
#mapping ⇒ Object (readonly)
Returns the value of attribute mapping.
4 5 6 |
# File 'lib/mongorm/repository/class_methods.rb', line 4 def mapping @mapping end |
Instance Method Details
#connection ⇒ Object
21 22 23 |
# File 'lib/mongorm/repository/class_methods.rb', line 21 def connection Mongorm.connection end |
#criteria ⇒ Object
25 26 27 |
# File 'lib/mongorm/repository/class_methods.rb', line 25 def criteria Criteria.new({}, {}, :mongo) end |
#fields ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/mongorm/repository/class_methods.rb', line 9 def fields return @fields if @fields methods = mapping.instance_methods - Object.instance_methods @fields = [] methods.each do |method| if method =~ /[^=]$/ @fields << method if methods.include? "#{method}=".to_sym end end @fields end |
#map_to(class_name) ⇒ Object
5 6 7 |
# File 'lib/mongorm/repository/class_methods.rb', line 5 def map_to(class_name) @mapping = class_name end |