Sha256: b3d6a8ca6025d1ba44eeca731c1996be7eedbc04245544c0baac164334a62457

Contents?: true

Size: 754 Bytes

Versions: 1

Compression:

Stored size: 754 Bytes

Contents

# encoding: UTF-8

module CucumberMonitor

  class Definition

    attr_accessor :description, :file

    def initialize(description, file)
      @description = description
      @file = file
    end

    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

    def content
      raw_content.collect{|c| c.strip }
    end

    def core_content
      content[1..-2].collect{|c| c.strip }
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cucumber_monitor-0.0.7 lib/cucumber_monitor/definition.rb