Class: CucumberMonitor::Definition
- Inherits:
-
Object
- Object
- CucumberMonitor::Definition
- Defined in:
- lib/cucumber_monitor/definition.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#file ⇒ Object
Returns the value of attribute file.
-
#line ⇒ Object
Returns the value of attribute line.
Instance Method Summary collapse
- #content ⇒ Object
- #core_content ⇒ Object
-
#initialize(description, file, line) ⇒ Definition
constructor
A new instance of Definition.
- #location ⇒ Object
- #location_path ⇒ Object
- #matcher ⇒ Object
- #raw_content ⇒ Object
Constructor Details
#initialize(description, file, line) ⇒ Definition
Returns a new instance of Definition.
9 10 11 12 13 |
# File 'lib/cucumber_monitor/definition.rb', line 9 def initialize(description, file, line) @description = description @file = file @line = line end |
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description.
7 8 9 |
# File 'lib/cucumber_monitor/definition.rb', line 7 def description @description end |
#file ⇒ Object
Returns the value of attribute file.
7 8 9 |
# File 'lib/cucumber_monitor/definition.rb', line 7 def file @file end |
#line ⇒ Object
Returns the value of attribute line.
7 8 9 |
# File 'lib/cucumber_monitor/definition.rb', line 7 def line @line end |
Instance Method Details
#content ⇒ Object
40 41 42 |
# File 'lib/cucumber_monitor/definition.rb', line 40 def content raw_content.collect{|c| c.strip } end |
#core_content ⇒ Object
44 45 46 |
# File 'lib/cucumber_monitor/definition.rb', line 44 def core_content content[1..-2].collect{|c| c.strip } end |
#location ⇒ Object
48 49 50 |
# File 'lib/cucumber_monitor/definition.rb', line 48 def location "#{file.file}:#{line}" end |
#location_path ⇒ Object
52 53 54 |
# File 'lib/cucumber_monitor/definition.rb', line 52 def location_path "#{file.path}:#{line}" end |
#matcher ⇒ Object
15 16 17 |
# File 'lib/cucumber_monitor/definition.rb', line 15 def matcher description.scan(/\/(.*)\//).flatten.first end |
#raw_content ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/cucumber_monitor/definition.rb', line 19 def raw_content df = [] started = false stopped = false record = false count = 0 file.lines.each_with_index do |line, i| if line.include?(description) started = true end if started && !stopped df << line stopped = true if line.strip.match(/^end$/) count += 1 end end df end |