Class: PlotStatistics::Clam
- Inherits:
-
Object
- Object
- PlotStatistics::Clam
- Defined in:
- lib/plot_statistics/clam.rb
Instance Attribute Summary collapse
-
#distances ⇒ Object
Returns the value of attribute distances.
-
#x ⇒ Object
Returns the value of attribute x.
-
#y ⇒ Object
Returns the value of attribute y.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(params = {}) ⇒ Clam
constructor
A new instance of Clam.
- #reset_distances ⇒ Object
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
#distances ⇒ Object
Returns the value of attribute distances.
3 4 5 |
# File 'lib/plot_statistics/clam.rb', line 3 def distances @distances end |
#x ⇒ Object
Returns the value of attribute x.
3 4 5 |
# File 'lib/plot_statistics/clam.rb', line 3 def x @x end |
#y ⇒ Object
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_random ⇒ Object
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_distances ⇒ Object
20 21 22 |
# File 'lib/plot_statistics/clam.rb', line 20 def reset_distances distances.clear end |