Class: Step

Inherits:
Object
  • Object
show all
Defined in:
lib/step.rb

Direct Known Subclasses

ObjcStep, RailsStep

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ Step

Returns a new instance of Step.



5
6
7
8
9
# File 'lib/step.rb', line 5

def initialize(hash)
  @body   = hash[:body]
  @parent = hash[:parent]
  raise "No body given" unless body
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



3
4
5
# File 'lib/step.rb', line 3

def body
  @body
end

#messageObject (readonly)

Returns the value of attribute message.



2
3
4
# File 'lib/step.rb', line 2

def message
  @message
end

#parentObject (readonly)

Returns the value of attribute parent.



3
4
5
# File 'lib/step.rb', line 3

def parent
  @parent
end

Instance Method Details

#aggregate!Object



18
19
20
21
# File 'lib/step.rb', line 18

def aggregate!
  @message = first_part + args_string
  self
end

#argsObject



27
28
29
# File 'lib/step.rb', line 27

def args
  @args ||= body.scan(/'([^']*)'/).map {|a| a[0]}
end

#has_args?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/step.rb', line 23

def has_args?
  !args.empty?
end

#to_htmlObject



11
12
13
14
15
16
# File 'lib/step.rb', line 11

def to_html
  s = <<-END
  <h3 class="step">#{body}</h3>
  END
  s.strip
end