Class: RailsEdgeTest::Dsl::LetHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_edge_test/dsl/let_handler.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeLetHandler

Returns a new instance of LetHandler.



5
6
7
# File 'lib/rails_edge_test/dsl/let_handler.rb', line 5

def initialize
  @let_blocks = {}
end

Instance Attribute Details

#let_blocksObject (readonly)

Returns the value of attribute let_blocks.



3
4
5
# File 'lib/rails_edge_test/dsl/let_handler.rb', line 3

def let_blocks
  @let_blocks
end

Instance Method Details

#add_definition(title, &block) ⇒ Object



9
10
11
# File 'lib/rails_edge_test/dsl/let_handler.rb', line 9

def add_definition(title, &block)
  @let_blocks[title] = block
end

#execute(title) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/rails_edge_test/dsl/let_handler.rb', line 13

def execute(title)
  block = @let_blocks[title]
  unless block
    fail NoMethodError, "no method or let block defined with name #{title}"
  end

  block.call
end