Module: Cucumber::Core::Gherkin::Writer::Indentation

Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/gherkin/writer/helpers.rb

Class Method Summary collapse

Class Method Details

.level(number) ⇒ Object



107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/gherkin/writer/helpers.rb', line 107

def self.level(number)
  Module.new do
    define_method :indent do |string, amount=nil|
      amount ||= number
      return string if string.nil? || string.empty?
      (' ' * amount) + string
    end

    define_method :indent_level do
      number
    end

    define_method :prepare_statements do |*statements|
      statements.flatten.compact.map { |s| indent(s) }
    end
  end
end