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.



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

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

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



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

def attributes
  @attributes
end

#bangObject (readonly)

Returns the value of attribute bang.



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

def bang
  @bang
end

#finderObject (readonly)

Returns the value of attribute finder.



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

def finder
  @finder
end

#instantiatorObject (readonly)

Returns the value of attribute instantiator.



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

def instantiator
  @instantiator
end

#methodObject (readonly)

Returns the value of attribute method.



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

def method
  @method
end

Instance Method Details

#found?Boolean

Returns:



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

def found?
  @finder.present?
end

#raise?Boolean

Returns:



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

def raise?
  bang == true
end