Class: CloseNeighbourhood
- Inherits:
-
Object
- Object
- CloseNeighbourhood
- Defined in:
- lib/cartesius/neighbourhoods.rb
Instance Method Summary collapse
- #include?(value) ⇒ Boolean
-
#initialize(center, width) ⇒ CloseNeighbourhood
constructor
A new instance of CloseNeighbourhood.
Constructor Details
#initialize(center, width) ⇒ CloseNeighbourhood
Returns a new instance of CloseNeighbourhood.
13 14 15 16 |
# File 'lib/cartesius/neighbourhoods.rb', line 13 def initialize(center, width) @center = center @width = width end |
Instance Method Details
#include?(value) ⇒ Boolean
18 19 20 |
# File 'lib/cartesius/neighbourhoods.rb', line 18 def include?(value) (value >= @center - @width) && (value <= @center + @width) end |