Class: OpenNeighbourhood

Inherits:
Object
  • Object
show all
Defined in:
lib/cartesius/neighbourhoods.rb

Instance Method Summary collapse

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

Returns:

  • (Boolean)


7
8
9
# File 'lib/cartesius/neighbourhoods.rb', line 7

def include?(value)
  (value > @center - @width) && (value < @center + @width)
end