Class: CloseNeighbourhood

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

Instance Method Summary collapse

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

Returns:

  • (Boolean)


18
19
20
# File 'lib/cartesius/neighbourhoods.rb', line 18

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