Class: RailsStep

Inherits:
Step
  • Object
show all
Defined in:
lib/Rails/rails_step.rb

Instance Attribute Summary

Attributes inherited from Step

#body, #message, #parent

Instance Method Summary collapse

Methods inherited from Step

#aggregate!, #args, #has_args?, #initialize, #to_html

Constructor Details

This class inherits a constructor from Step

Instance Method Details

#args_stringObject



8
9
10
11
12
13
14
# File 'lib/Rails/rails_step.rb', line 8

def args_string
  if has_args?
    "(" + args.map {|a| '"' + a.to_s + '"'}.join(", ") + ")"
  else
    ""
  end
end

#first_partObject



2
3
4
5
6
# File 'lib/Rails/rails_step.rb', line 2

def first_part
  body.gsub(/\s+/,"_").gsub(/'[^']*'/, "__").remove_invalid_chars.sub(/./) do |first_char|
    first_char.downcase
  end
end

#parameter_stringObject



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/Rails/rails_step.rb', line 20

def parameter_string
  if has_args?
    s = "(arg"
    (args[1..args.length] || []).each_with_index do |a, i|
      s << ", arg#{i+2}"
    end
    s + ")"
  else
    ""
  end
end

#to_sObject



16
17
18
# File 'lib/Rails/rails_step.rb', line 16

def to_s
  message
end