Class: Crew::Home::DSL
- Inherits:
-
Object
- Object
- Crew::Home::DSL
- Defined in:
- lib/crew/home/dsl.rb
Instance Method Summary collapse
- #after(&cb) ⇒ Object
- #before(&cb) ⇒ Object
- #context(name, &blk) ⇒ Object
- #default_context(name) ⇒ Object
- #default_test(name) ⇒ Object
- #hint(hint) ⇒ Object
-
#initialize(home) ⇒ DSL
constructor
A new instance of DSL.
- #load(path = nil, &blk) ⇒ Object
- #source(source) ⇒ Object
- #test(name, &blk) ⇒ Object
Constructor Details
#initialize(home) ⇒ DSL
Returns a new instance of DSL.
4 5 6 |
# File 'lib/crew/home/dsl.rb', line 4 def initialize(home) @home = home end |
Instance Method Details
#after(&cb) ⇒ Object
12 13 14 |
# File 'lib/crew/home/dsl.rb', line 12 def after(&cb) @home.add_callback(:after, &cb) end |
#before(&cb) ⇒ Object
8 9 10 |
# File 'lib/crew/home/dsl.rb', line 8 def before(&cb) @home.add_callback(:before, &cb) end |
#context(name, &blk) ⇒ Object
21 22 23 |
# File 'lib/crew/home/dsl.rb', line 21 def context(name, &blk) @home.add_context(name, &blk) end |
#default_context(name) ⇒ Object
25 26 27 |
# File 'lib/crew/home/dsl.rb', line 25 def default_context(name) @home.default_context_name = name end |
#default_test(name) ⇒ Object
41 42 43 |
# File 'lib/crew/home/dsl.rb', line 41 def default_test(name) @home.default_test_name = name end |
#hint(hint) ⇒ Object
33 34 35 |
# File 'lib/crew/home/dsl.rb', line 33 def hint(hint) @home.hints << hint end |
#load(path = nil, &blk) ⇒ Object
16 17 18 19 |
# File 'lib/crew/home/dsl.rb', line 16 def load(path = nil, &blk) instance_eval(File.read(path), path, 1) if path instance_eval(&blk) if blk end |
#source(source) ⇒ Object
29 30 31 |
# File 'lib/crew/home/dsl.rb', line 29 def source(source) @home.sources << source end |
#test(name, &blk) ⇒ Object
37 38 39 |
# File 'lib/crew/home/dsl.rb', line 37 def test(name, &blk) @home.add_tester(name, &blk) end |