Module: Mongoid::Extensions::Symbol::Inflections

Defined in:
lib/mongoid_spacial/extentions/symbol/inflections.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#near(calc = :flat) ⇒ Criterion::NearSpacial

return a class that will accept a value to convert the query correctly for near

Parameters:

  • calc (Symbol) (defaults to: :flat)

    This accepts :sphere

Returns:



13
14
15
# File 'lib/mongoid_spacial/extentions/symbol/inflections.rb', line 13

def near(calc = :flat)
  Criterion::NearSpacial.new(:operator => get_op('near',calc), :key => self)          
end

#near_sphereCriterion::NearSpacial

alias for self.near(:sphere)



20
21
22
# File 'lib/mongoid_spacial/extentions/symbol/inflections.rb', line 20

def near_sphere
  self.near(:sphere)
end

#within(shape) ⇒ Criterion::WithinSpacial

Parameters:

  • shape (Symbol)

    :box,:polygon,:center,:center_sphere

Returns:



27
28
29
30
# File 'lib/mongoid_spacial/extentions/symbol/inflections.rb', line 27

def within(shape)
  shape = get_op(:center,:sphere) if shape == :center_sphere
  Criterion::WithinSpacial.new(:operator => shape.to_s , :key => self)
end