Class: Step
- Inherits:
-
Object
- Object
- Step
- Defined in:
- lib/step.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
Instance Method Summary collapse
- #aggregate! ⇒ Object
- #args ⇒ Object
- #has_args? ⇒ Boolean
-
#initialize(hash) ⇒ Step
constructor
A new instance of Step.
- #to_html ⇒ Object
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
#body ⇒ Object (readonly)
Returns the value of attribute body.
3 4 5 |
# File 'lib/step.rb', line 3 def body @body end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
2 3 4 |
# File 'lib/step.rb', line 2 def @message end |
#parent ⇒ Object (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 |
#args ⇒ Object
27 28 29 |
# File 'lib/step.rb', line 27 def args @args ||= body.scan(/'([^']*)'/).map {|a| a[0]} end |
#has_args? ⇒ Boolean
23 24 25 |
# File 'lib/step.rb', line 23 def has_args? !args.empty? end |
#to_html ⇒ Object
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 |