Parent

Class/Module Index [+]

Quicksearch

Rouge::Lexers::Gherkin

Public Class Methods

analyze_text(text) click to toggle source
# File lib/rouge/lexers/gherkin.rb, line 13
def self.analyze_text(text)
  return 1 if text.shebang? 'cucumber'
end
keywords() click to toggle source

self-modifying method that loads the keywords file

# File lib/rouge/lexers/gherkin.rb, line 18
def self.keywords
  load Pathname.new(__FILE__).dirname.join('gherkin/keywords.rb')
  keywords
end
step_regex() click to toggle source
# File lib/rouge/lexers/gherkin.rb, line 23
def self.step_regex
  # in Gherkin's config, keywords that end in < don't
  # need word boundaries at the ends - all others do.
  @step_regex ||= Regexp.new(
    keywords[:step].map do |w|
      if w.end_with? '<'
        Regexp.escape(w.chop)
      else
        "#{Regexp.escape(w)}\\b"
      end
    end.join('|')
  )
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.