Class: PlotStatistics::Clam

Inherits:
Object
  • Object
show all
Defined in:
lib/plot_statistics/clam.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ Clam

Returns a new instance of Clam.



5
6
7
8
9
# File 'lib/plot_statistics/clam.rb', line 5

def initialize(params={})
  @x = params[:x].to_f
  @y = params[:y].to_f
  @distances = params[:distances] || []
end

Instance Attribute Details

#distancesObject

Returns the value of attribute distances.



3
4
5
# File 'lib/plot_statistics/clam.rb', line 3

def distances
  @distances
end

#xObject

Returns the value of attribute x.



3
4
5
# File 'lib/plot_statistics/clam.rb', line 3

def x
  @x
end

#yObject

Returns the value of attribute y.



3
4
5
# File 'lib/plot_statistics/clam.rb', line 3

def y
  @y
end

Class Method Details

.create_randomObject



11
12
13
# File 'lib/plot_statistics/clam.rb', line 11

def self.create_random
  new( :x => rand(100), :y => rand(100) )
end

Instance Method Details

#==(other) ⇒ Object



15
16
17
18
# File 'lib/plot_statistics/clam.rb', line 15

def ==(other)
  return super(other) unless other.kind_of?(PlotStatistics::Clam)
  self.x == other.x && self.y == other.y
end

#reset_distancesObject



20
21
22
# File 'lib/plot_statistics/clam.rb', line 20

def reset_distances
  distances.clear
end