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.
5 6 7 |
# File 'lib/rails_edge_test/dsl/let_handler.rb', line 5 def initialize @let_blocks = {} end |
Instance Attribute Details
#let_blocks ⇒ Object (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 |