Class: NoBrainer::Geo::Polygon

Inherits:
Struct
  • Object
show all
Includes:
Base
Defined in:
lib/no_brainer/geo/polygon.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Base

normalize_geo_options

Constructor Details

#initialize(*points) ⇒ Polygon

Returns a new instance of Polygon.



4
5
6
# File 'lib/no_brainer/geo/polygon.rb', line 4

def initialize(*points)
  self.points = points.map { |p| NoBrainer::Geo::Point.nobrainer_cast_user_to_model(p) }
end

Instance Attribute Details

#pointsObject

Returns the value of attribute points

Returns:

  • (Object)

    the current value of points



1
2
3
# File 'lib/no_brainer/geo/polygon.rb', line 1

def points
  @points
end

Instance Method Details

#to_rqlObject



8
9
10
# File 'lib/no_brainer/geo/polygon.rb', line 8

def to_rql
  RethinkDB::RQL.new.polygon(points.map(&:to_rql))
end