rulebook 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/README.md +1 -1
  2. data/VERSION +1 -1
  3. data/lib/rulebook.rb +2 -2
  4. data/rulebook.gemspec +1 -1
  5. metadata +2 -2
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # rulebook (0.2.0)
1
+ # rulebook
2
2
 
3
3
  Allows you to define a set of 'rules' or dynamic methods to apply to a class.
4
4
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
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
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rulebook}
8
- s.version = "0.2.0"
8
+ s.version = "0.2.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Ryan Lewis"]
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 0
9
- version: 0.2.0
8
+ - 1
9
+ version: 0.2.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Ryan Lewis