Class: Fit::TimedActionFixture
- Inherits:
-
ActionFixture
- Object
- Fixture
- ActionFixture
- Fit::TimedActionFixture
- Defined in:
- lib/fit/timed_action_fixture.rb
Direct Known Subclasses
Constant Summary
Constants inherited from Fixture
Fixture::GRAY, Fixture::GREEN, Fixture::RED, Fixture::YELLOW
Instance Attribute Summary collapse
-
#format ⇒ Object
Returns the value of attribute format.
Attributes inherited from Fixture
#args, #counts, #listener, #summary
Instance Method Summary collapse
- #do_cells(cells) ⇒ Object
- #do_table(table) ⇒ Object
-
#initialize ⇒ TimedActionFixture
constructor
A new instance of TimedActionFixture.
-
#td(body) ⇒ Object
Utility.
- #time ⇒ Object
Methods inherited from ActionFixture
actor, actor=, #check, #enter, #press, #start
Methods inherited from Fixture
camel, #check, #do_cell, #do_row, #do_rows, #do_tables, #error, escape, #exception, #find_class, #fixture_name, #get_args_for_table, #get_linked_fixture_with_args, gray, #ignore, #info, #interpret_following_tables, #interpret_tables, label, metadata, #parse, #right, #total_errors, #totals, #wrong
Constructor Details
#initialize ⇒ TimedActionFixture
Returns a new instance of TimedActionFixture.
10 11 12 13 |
# File 'lib/fit/timed_action_fixture.rb', line 10 def initialize super @format = '%H:%M:%S' end |
Instance Attribute Details
#format ⇒ Object
Returns the value of attribute format.
9 10 11 |
# File 'lib/fit/timed_action_fixture.rb', line 9 def format @format end |
Instance Method Details
#do_cells(cells) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/fit/timed_action_fixture.rb', line 19 def do_cells cells start = time super split = time - start cells.last.more = td(start.strftime(@format)) cells.last.more = td(split < 1 ? ' ' : sprintf("%1.1f", split)) end |
#do_table(table) ⇒ Object
14 15 16 17 18 |
# File 'lib/fit/timed_action_fixture.rb', line 14 def do_table table super table.parts.parts.last.more = td('time') table.parts.parts.last.more = td('split') end |
#td(body) ⇒ Object
Utility
27 28 29 |
# File 'lib/fit/timed_action_fixture.rb', line 27 def td body ParseHolder.create('td', Fixture.gray(body), nil, nil) end |
#time ⇒ Object
30 31 32 |
# File 'lib/fit/timed_action_fixture.rb', line 30 def time Time.now end |