rulebook 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +1 -1
- data/VERSION +1 -1
- data/lib/rulebook.rb +2 -2
- data/rulebook.gemspec +1 -1
- metadata +2 -2
data/README.md
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.1
|
data/lib/rulebook.rb
CHANGED
@@ -42,7 +42,6 @@ class RuleBook
|
|
42
42
|
rules = rulebook.find_rules_that_match_against(meth)
|
43
43
|
|
44
44
|
unless rules.nil?
|
45
|
-
raise(ArgumentError, 'rules must have a block') unless block_given?
|
46
45
|
rule = rules.first
|
47
46
|
match = rule.match_against(meth)
|
48
47
|
instance_exec(*match.captures, *args, &rule.block)
|
@@ -58,7 +57,6 @@ class RuleBook
|
|
58
57
|
rules = rulebook.find_rules_that_match_against(meth)
|
59
58
|
|
60
59
|
unless rules.nil?
|
61
|
-
raise(ArgumentError, 'rules must have a block') unless block_given?
|
62
60
|
rule = rules.first
|
63
61
|
match = rule.match_against(meth)
|
64
62
|
class_exec(*match.captures, *args, &rule.block)
|
@@ -71,6 +69,7 @@ end
|
|
71
69
|
|
72
70
|
class Module
|
73
71
|
def rules(&blk)
|
72
|
+
raise(ArgumentError, 'rules must have a block') unless block_given?
|
74
73
|
unless const_defined?('INSTANCE_RULEBOOK')
|
75
74
|
const_set('INSTANCE_RULEBOOK', RuleBook.new)
|
76
75
|
include RuleBook::InstanceMethods
|
@@ -80,6 +79,7 @@ class Module
|
|
80
79
|
end
|
81
80
|
|
82
81
|
def class_rules(&blk)
|
82
|
+
raise(ArgumentError, 'class_rules must have a block') unless block_given?
|
83
83
|
unless const_defined?('CLASS_NOTEBOOK')
|
84
84
|
const_set('CLASS_NOTEBOOK', RuleBook.new)
|
85
85
|
extend RuleBook::ClassMethods
|
data/rulebook.gemspec
CHANGED