forked from RiverGlide/CukeSalad
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move this into its own module, defined so it can be accessed either b…
…y inclusion of TaskAuthor, or as TaskAuthor.in_order_to
- Loading branch information
Showing
2 changed files
with
43 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,21 @@ | ||
require 'cukesalad/codify/const_name' | ||
def in_order_to do_something, *with_attributes, &actions | ||
attr_map = with_attributes[0] | ||
name = Codify::ConstName.from do_something | ||
m = Module.new do | ||
define_method :perform_task, &actions | ||
define_method :the do | value | | ||
value_of( attr_map.key value ) | ||
module CukeSalad | ||
module TaskAuthor | ||
|
||
def in_order_to do_something, *with_attributes, &actions | ||
TaskAuthor.in_order_to do_something, *with_attributes, &actions | ||
end | ||
|
||
def TaskAuthor.in_order_to do_something, *with_attributes, &actions | ||
attr_map = with_attributes[0] | ||
name = Codify::ConstName.from do_something | ||
m = Module.new do | ||
define_method :perform_task, &actions | ||
define_method :the do | value | | ||
value_of( attr_map.key value ) | ||
end | ||
end | ||
Kernel.const_set name, m | ||
end | ||
end | ||
Kernel.const_set name, m | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters