Class: OpenNeighbourhood
- Inherits:
-
Object
- Object
- OpenNeighbourhood
- Defined in:
- lib/cartesius/neighbourhoods.rb
Instance Method Summary collapse
- #include?(value) ⇒ Boolean
-
#initialize(center, width) ⇒ OpenNeighbourhood
constructor
A new instance of OpenNeighbourhood.
Constructor Details
#initialize(center, width) ⇒ OpenNeighbourhood
Returns a new instance of OpenNeighbourhood.
2 3 4 5 |
# File 'lib/cartesius/neighbourhoods.rb', line 2 def initialize(center, width) @center = center @width = width end |
Instance Method Details
#include?(value) ⇒ Boolean
7 8 9 |
# File 'lib/cartesius/neighbourhoods.rb', line 7 def include?(value) (value > @center - @width) && (value < @center + @width) end |