Class: CucumberMonitor::Context
- Inherits:
-
Object
- Object
- CucumberMonitor::Context
- Defined in:
- lib/cucumber_monitor/context.rb
Instance Attribute Summary collapse
-
#feature ⇒ Object
Returns the value of attribute feature.
-
#keyword ⇒ Object
Returns the value of attribute keyword.
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(name, feature) ⇒ Context
constructor
A new instance of Context.
- #steps ⇒ Object
Constructor Details
#initialize(name, feature) ⇒ Context
Returns a new instance of Context.
9 10 11 12 13 |
# File 'lib/cucumber_monitor/context.rb', line 9 def initialize(name,feature) @name = name @keyword = I18n.t("background") @feature = feature end |
Instance Attribute Details
#feature ⇒ Object
Returns the value of attribute feature.
7 8 9 |
# File 'lib/cucumber_monitor/context.rb', line 7 def feature @feature end |
#keyword ⇒ Object
Returns the value of attribute keyword.
7 8 9 |
# File 'lib/cucumber_monitor/context.rb', line 7 def keyword @keyword end |
#name ⇒ Object
Returns the value of attribute name.
7 8 9 |
# File 'lib/cucumber_monitor/context.rb', line 7 def name @name end |
Instance Method Details
#steps ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/cucumber_monitor/context.rb', line 15 def steps st = [] started = false stopped = false record = false count = 0 feature.lines.each_with_index do |line, i| if line.include?(keyword) started = true end if started && !stopped st << Step.new(line.strip, self, i+1) unless (count == 0 || line.strip.blank?) stopped = true if line.strip.blank? count += 1 end end st end |