Class: RailsEdgeTest::Dsl::LetHandler
- Inherits:
-
Object
- Object
- RailsEdgeTest::Dsl::LetHandler
- Defined in:
- lib/rails_edge_test/dsl/let_handler.rb
Instance Attribute Summary collapse
-
#let_blocks ⇒ Object
readonly
Returns the value of attribute let_blocks.
Instance Method Summary collapse
- #add_definition(title, &block) ⇒ Object
- #execute(title) ⇒ Object
-
#initialize ⇒ LetHandler
constructor
A new instance of LetHandler.
Constructor Details
#initialize ⇒ LetHandler
Returns a new instance of LetHandler.
8 9 10 |
# File 'lib/rails_edge_test/dsl/let_handler.rb', line 8 def initialize @let_blocks = {} end |
Instance Attribute Details
#let_blocks ⇒ Object (readonly)
Returns the value of attribute let_blocks.
6 7 8 |
# File 'lib/rails_edge_test/dsl/let_handler.rb', line 6 def let_blocks @let_blocks end |
Instance Method Details
#add_definition(title, &block) ⇒ Object
12 13 14 |
# File 'lib/rails_edge_test/dsl/let_handler.rb', line 12 def add_definition(title, &block) @let_blocks[title] = block end |
#execute(title) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/rails_edge_test/dsl/let_handler.rb', line 16 def execute(title) block = @let_blocks[title] raise NoMethodError, "no method or let block defined with name #{title}" unless block block.call end |