Class: ApproximateValue
- Inherits:
-
Object
- Object
- ApproximateValue
- Defined in:
- lib/test_ish.rb
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(me, acceptable_delta) ⇒ ApproximateValue
constructor
A new instance of ApproximateValue.
- #to_s ⇒ Object
Constructor Details
#initialize(me, acceptable_delta) ⇒ ApproximateValue
Returns a new instance of ApproximateValue.
9 10 11 12 |
# File 'lib/test_ish.rb', line 9 def initialize(me, acceptable_delta) @me = me @acceptable_delta = acceptable_delta end |
Instance Method Details
#==(other) ⇒ Object
14 15 16 |
# File 'lib/test_ish.rb', line 14 def ==(other) (other - @me).abs < @acceptable_delta end |
#to_s ⇒ Object
18 19 20 |
# File 'lib/test_ish.rb', line 18 def to_s "within #{@acceptable_delta} of #{@me}" end |