Class: Frogger::Frog
- Inherits:
-
Object
- Object
- Frogger::Frog
- Defined in:
- lib/frogger/frog.rb
Instance Attribute Summary collapse
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#scenario ⇒ Object
readonly
Returns the value of attribute scenario.
-
#step_index ⇒ Object
Returns the value of attribute step_index.
Instance Method Summary collapse
-
#initialize(scenario, logger = default_logger) ⇒ Frog
constructor
A new instance of Frog.
- #log_scenario ⇒ Object
- #log_step ⇒ Object
- #scenario_outline? ⇒ Boolean
Constructor Details
#initialize(scenario, logger = default_logger) ⇒ Frog
Returns a new instance of Frog.
5 6 7 8 9 |
# File 'lib/frogger/frog.rb', line 5 def initialize(scenario, logger = default_logger) @scenario = scenario @logger = logger @step_index = 0 end |
Instance Attribute Details
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
2 3 4 |
# File 'lib/frogger/frog.rb', line 2 def logger @logger end |
#scenario ⇒ Object (readonly)
Returns the value of attribute scenario.
2 3 4 |
# File 'lib/frogger/frog.rb', line 2 def scenario @scenario end |
#step_index ⇒ Object
Returns the value of attribute step_index.
3 4 5 |
# File 'lib/frogger/frog.rb', line 3 def step_index @step_index end |
Instance Method Details
#log_scenario ⇒ Object
11 12 13 14 15 16 |
# File 'lib/frogger/frog.rb', line 11 def log_scenario padding = max_length - 2 - scenario.name.length logger.debug( "\n\n #{scenario.name.upcase}#{ ' ' * padding } ".black_on_green ) end |
#log_step ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/frogger/frog.rb', line 18 def log_step return if step.nil? step_to_s = "#{step.keyword}#{step.name}" padding = [max_length - 4 - step_to_s.length, 0].max logger.debug "\n #{ step_to_s }#{ ' ' * padding } ".black_on_yellow self.step_index += 1 end |
#scenario_outline? ⇒ Boolean
29 30 31 |
# File 'lib/frogger/frog.rb', line 29 def scenario_outline? scenario.class == Cucumber::Ast::OutlineTable::ExampleRow end |