Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/stiff/aasm into merging-s…
…tiff-master Conflicts: README.md lib/aasm.rb lib/aasm/event.rb lib/aasm/transition.rb spec/unit/transition_spec.rb
- Loading branch information
Showing
9 changed files
with
141 additions
and
81 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
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 |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
errors | ||
configuration | ||
base | ||
dsl_helper | ||
instance_base | ||
transition | ||
event | ||
|
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
module DslHelper | ||
|
||
class Proxy | ||
attr_accessor :options | ||
|
||
def initialize(options, valid_keys, source) | ||
@valid_keys = valid_keys | ||
@source = source | ||
|
||
@options = options | ||
end | ||
|
||
def method_missing(name, *args, &block) | ||
if @valid_keys.include?(name) | ||
options[name] = Array(options[name]) | ||
options[name] << block if block | ||
options[name] += Array(args) | ||
else | ||
@source.send name, *args, &block | ||
end | ||
end | ||
end | ||
|
||
def add_options_from_dsl(options, valid_keys, &block) | ||
proxy = Proxy.new(options, valid_keys, self) | ||
proxy.instance_eval(&block) | ||
proxy.options | ||
end | ||
|
||
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
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
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
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
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
Oops, something went wrong.