Class: RBehave::Story

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(title, narrative, params = {}, &body) ⇒ Story

Returns a new instance of Story.



5
6
7
8
9
10
# File 'lib/rbehave/story.rb', line 5

def initialize(title, narrative, params = {}, &body)
  @body = body
  @title = title
  @narrative = narrative
  @params = params
end

Instance Attribute Details

#narrativeObject (readonly)

Returns the value of attribute narrative.



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

def narrative
  @narrative
end

#titleObject (readonly)

Returns the value of attribute title.



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

def title
  @title
end

Instance Method Details

#[](key) ⇒ Object



12
13
14
# File 'lib/rbehave/story.rb', line 12

def [](key)
  @params[key]
end

#run_in(obj) ⇒ Object



16
17
18
# File 'lib/rbehave/story.rb', line 16

def run_in(obj)
  obj.instance_eval(&@body)
end