Files

Class/Module Index [+]

Quicksearch

Cucumber::Formatter::Console

This module contains helper methods that are used by formatters that print output to the terminal.

Constants

FORMATS

Public Instance Methods

embed(file, mime_type, label) click to toggle source
# File lib/cucumber/formatter/console.rb, line 137
def embed(file, mime_type, label)
  # no-op
end
empty_messages() click to toggle source
# File lib/cucumber/formatter/console.rb, line 174
def empty_messages
  @delayed_messages = []
end
format_step(keyword, step_match, status, source_indent) click to toggle source
# File lib/cucumber/formatter/console.rb, line 16
def format_step(keyword, step_match, status, source_indent)
  comment = if source_indent
    c = (' # ' + step_match.file_colon_line).indent(source_indent)
    format_string(c, :comment)
  else
    ''
  end

  format = format_for(status, :param)
  line = keyword + step_match.format_args(format) + comment
  format_string(line, status)
end
format_string(o, status) click to toggle source
# File lib/cucumber/formatter/console.rb, line 29
def format_string(o, status)
  fmt = format_for(status)
  o.to_s.split("\n").map do |line|
    if Proc === fmt
      fmt.call(line)
    else
      fmt % line
    end
  end.join("\n")
end
linebreaks(s, max) click to toggle source

blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/10655

# File lib/cucumber/formatter/console.rb, line 95
def linebreaks(s, max)
  s.gsub(/.{1,#{max}}(?:\s|\Z)/){($& + 5.chr).gsub(/\n\0005/,"\n").gsub(/\0005/,"\n")}.rstrip
end
puts(*messages) click to toggle source

define @delayed_messages = [] in your Formatter if you want to activate this feature

# File lib/cucumber/formatter/console.rb, line 143
def puts(*messages)
  if @delayed_messages
    @delayed_messages += messages
  else
    if @io
      @io.puts
      messages.each do |message|
        @io.puts(format_string(message, :tag))
      end
      @io.flush
    end
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.