Class: NoBrainer::Geo::Circle
- Inherits:
-
Struct
- Object
- Struct
- NoBrainer::Geo::Circle
- Includes:
- Base
- Defined in:
- lib/no_brainer/geo/circle.rb
Instance Attribute Summary collapse
-
#center ⇒ Object
Returns the value of attribute center.
-
#options ⇒ Object
Returns the value of attribute options.
-
#radius ⇒ Object
Returns the value of attribute radius.
Instance Method Summary collapse
-
#initialize(*args) ⇒ Circle
constructor
A new instance of Circle.
- #to_rql ⇒ Object
Methods included from Base
Constructor Details
#initialize(*args) ⇒ Circle
Returns a new instance of Circle.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/no_brainer/geo/circle.rb', line 4 def initialize(*args) = args. = NoBrainer::Geo::Base.() raise NoBrainer::Error::InvalidType if args.size > 2 center = args[0] || .delete(:center) radius = args[1] || .delete(:radius) center = NoBrainer::Geo::Point.nobrainer_cast_user_to_model(center) radius = Float.nobrainer_cast_user_to_model(radius) self.center = center self.radius = radius self. = end |
Instance Attribute Details
#center ⇒ Object
Returns the value of attribute center
1 2 3 |
# File 'lib/no_brainer/geo/circle.rb', line 1 def center @center end |
#options ⇒ Object
Returns the value of attribute options
1 2 3 |
# File 'lib/no_brainer/geo/circle.rb', line 1 def @options end |
#radius ⇒ Object
Returns the value of attribute radius
1 2 3 |
# File 'lib/no_brainer/geo/circle.rb', line 1 def radius @radius end |
Instance Method Details
#to_rql ⇒ Object
20 21 22 |
# File 'lib/no_brainer/geo/circle.rb', line 20 def to_rql RethinkDB::RQL.new.circle(center.to_rql, radius, ) end |