### Home Classes Methods

### In Files

- lib/gherkin/formatter/argument.rb

### Parent

Object

### Methods

- ::format
- ::new

### Files

- LICENSE
- README.rdoc
- meta.txt
- root.txt
- steps.txt
- README.rdoc

### Class/Module Index

Quicksearch

- Gherkin
- Gherkin::CLexer
- Gherkin::Cli
- Gherkin::Cli::Main
- Gherkin::Formatter
- Gherkin::Formatter::Argument
- Gherkin::Formatter::Colors
- Gherkin::Formatter::Escaping
- Gherkin::Formatter::JSONFormatter
- Gherkin::Formatter::MonochromeFormat
- Gherkin::Formatter::PrettyFormatter
- Gherkin::I18n
- Gherkin::I18nLexer
- Gherkin::JSONLexer
- Gherkin::Parser
- Gherkin::Parser::Event
- Gherkin::Parser::FilterListener
- Gherkin::Parser::FormatterListener
- Gherkin::Parser::ParseError
- Gherkin::Parser::Parser
- Gherkin::Parser::Parser::Machine
- Gherkin::Parser::Parser::Machine::StateMachineReader
- Gherkin::Parser::Row
- Gherkin::Parser::TagExpression
- Gherkin::RbLexer
- Gherkin::Rubify
- Gherkin::Tools
- Gherkin::Tools::Files
- Gherkin::Tools::Reformat
- Gherkin::Tools::Stats
- Gherkin::Tools::StatsListener
- Class

No matching classes.

# Gherkin::Formatter::Argument

### Attributes

byte_offset[R]
val[R]

### Public Class Methods

format(string, argument_format, arguments) click to toggle source

    # File lib/gherkin/formatter/argument.rb, line 13
    def self.format(string, argument_format, arguments)
      s = string.dup
      offset = past_offset = 0
      arguments.each do |arg|
        next if arg.byte_offset.nil? || arg.byte_offset < past_offset
        replacement = argument_format.format_argument(arg.val)
        s[arg.byte_offset + offset, arg.val.length] = replacement
        offset += replacement.unpack("U*").length - arg.val.unpack("U*").length
        past_offset = arg.byte_offset + arg.val.length
      end
      s
    end

new(byte_offset, val) click to toggle source

    # File lib/gherkin/formatter/argument.rb, line 9
    def initialize(byte_offset, val)
      @byte_offset, @val = byte_offset, val
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.