Class: Eg::Sqrt
- Inherits:
-
Fit::ColumnFixture
- Object
- Fit::Fixture
- Fit::ColumnFixture
- Eg::Sqrt
- Defined in:
- lib/eg/sqrt.rb
Constant Summary
Constants inherited from Fit::Fixture
Fit::Fixture::GRAY, Fit::Fixture::GREEN, Fit::Fixture::RED, Fit::Fixture::YELLOW
Instance Attribute Summary collapse
-
#value ⇒ Object
Returns the value of attribute value.
Attributes inherited from Fit::Fixture
#args, #counts, #listener, #summary
Instance Method Summary collapse
Methods inherited from Fit::ColumnFixture
#check, #do_cell, #do_row, #do_rows, #execute, #reset
Methods inherited from Fit::Fixture
camel, #check, #do_cell, #do_cells, #do_row, #do_rows, #do_table, #do_tables, #error, escape, #exception, #find_class, #fixture_name, #get_args_for_table, #get_linked_fixture_with_args, gray, #ignore, #info, #initialize, #interpret_following_tables, #interpret_tables, label, metadata, #parse, #right, #total_errors, #totals, #wrong
Constructor Details
This class inherits a constructor from Fit::Fixture
Instance Attribute Details
#value ⇒ Object
Returns the value of attribute value.
9 10 11 |
# File 'lib/eg/sqrt.rb', line 9 def value @value end |
Instance Method Details
#sqrt ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/eg/sqrt.rb', line 10 def sqrt # But Math.sqrt already raise an error if its parameter is less than zero... # and in fact this guard clause is present because the java.lang.Math method # for sqare radix would return NaN if its argument is negative. raise "negative sqrt" if @value < 0 Math.sqrt @value end |