Class: MongoMapper::Plugins::DynamicQuerying::DynamicFinder

Inherits:
Object
  • Object
show all
Defined in:
lib/mongo_mapper/plugins/dynamic_querying/dynamic_finder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(method) ⇒ DynamicFinder

Returns a new instance of DynamicFinder.



8
9
10
11
12
13
# File 'lib/mongo_mapper/plugins/dynamic_querying/dynamic_finder.rb', line 8

def initialize(method)
  @method = method
  @finder = :first
  @bang   = false
  match
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



6
7
8
# File 'lib/mongo_mapper/plugins/dynamic_querying/dynamic_finder.rb', line 6

def attributes
  @attributes
end

#bangObject (readonly)

Returns the value of attribute bang.



6
7
8
# File 'lib/mongo_mapper/plugins/dynamic_querying/dynamic_finder.rb', line 6

def bang
  @bang
end

#finderObject (readonly)

Returns the value of attribute finder.



6
7
8
# File 'lib/mongo_mapper/plugins/dynamic_querying/dynamic_finder.rb', line 6

def finder
  @finder
end

#instantiatorObject (readonly)

Returns the value of attribute instantiator.



6
7
8
# File 'lib/mongo_mapper/plugins/dynamic_querying/dynamic_finder.rb', line 6

def instantiator
  @instantiator
end

#methodObject (readonly)

Returns the value of attribute method.



6
7
8
# File 'lib/mongo_mapper/plugins/dynamic_querying/dynamic_finder.rb', line 6

def method
  @method
end

Instance Method Details

#found?Boolean

Returns:



15
16
17
# File 'lib/mongo_mapper/plugins/dynamic_querying/dynamic_finder.rb', line 15

def found?
  @finder.present?
end

#raise?Boolean

Returns:



19
20
21
# File 'lib/mongo_mapper/plugins/dynamic_querying/dynamic_finder.rb', line 19

def raise?
  bang == true
end