Class: Cuker::GherkinRipper

Inherits:
Object
  • Object
show all
Includes:
GherkinHelper, LoggerSetup
Defined in:
lib/cuker/gherkin_ripper.rb

Constant Summary collapse

NoFilesFoundError =
Class.new IOError

Instance Attribute Summary collapse

Attributes included from LoggerSetup

#log

Instance Method Summary collapse

Methods included from LoggerSetup

#init_logger, reset_appender_log_levels

Methods included from GherkinHelper

#error_digest, #parse_handle

Constructor Details

#initialize(path = '*') ⇒ GherkinRipper

attr_reader :ast_map



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/cuker/gherkin_ripper.rb', line 19

def initialize path = '*'
  init_logger

  @location = path.strip
  @location = '.' if @location.empty? # handle blank path searching all features

  ext = '.feature'
  @features = get_files @location, ext

  @log.trace "Gherkin ripper running at #{path}"
  @parser = Gherkin::Parser.new
  @ast_map = {}

  @log.trace "Parsed '.feature' files @ #{path} = #{@features.size} files"
end

Instance Attribute Details

#featuresObject

Returns the value of attribute features.



16
17
18
# File 'lib/cuker/gherkin_ripper.rb', line 16

def features
  @features
end

#locationObject

Returns the value of attribute location.



15
16
17
# File 'lib/cuker/gherkin_ripper.rb', line 15

def location
  @location
end

Instance Method Details

#ast_mapObject



35
36
37
38
# File 'lib/cuker/gherkin_ripper.rb', line 35

def ast_map
  @ast_map = parse_all if @ast_map.empty?
  @ast_map
end