roleful 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/roleful/role.rb +10 -2
- metadata +5 -5
data/lib/roleful/role.rb
CHANGED
@@ -10,7 +10,11 @@ module Roleful
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def can(sym, &block)
|
13
|
-
handlers[sym] = block ||
|
13
|
+
handlers[sym] = block || if RUBY_VERSION < "1.9.0"
|
14
|
+
proc { true }
|
15
|
+
else
|
16
|
+
proc { |arg| true }
|
17
|
+
end
|
14
18
|
|
15
19
|
metaclass.class_eval(<<-END, __FILE__, __LINE__)
|
16
20
|
def can_#{sym}?(target, *args)
|
@@ -60,7 +64,11 @@ module Roleful
|
|
60
64
|
end
|
61
65
|
|
62
66
|
def define_predicates
|
63
|
-
|
67
|
+
if RUBY_VERSION < "1.9.0"
|
68
|
+
meta_def("#{name}?") { true }
|
69
|
+
else
|
70
|
+
meta_def("#{name}?") { |arg| true }
|
71
|
+
end
|
64
72
|
delegate_predicate("#{name}?")
|
65
73
|
delegate_predicate("can?")
|
66
74
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: roleful
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pat Nakajima
|
@@ -31,15 +31,15 @@ extensions: []
|
|
31
31
|
extra_rdoc_files: []
|
32
32
|
|
33
33
|
files:
|
34
|
-
- lib/core_ext
|
35
34
|
- lib/core_ext/array.rb
|
36
35
|
- lib/core_ext/object.rb
|
37
|
-
- lib/roleful
|
38
36
|
- lib/roleful/inclusion.rb
|
39
37
|
- lib/roleful/role.rb
|
40
38
|
- lib/roleful.rb
|
41
|
-
has_rdoc:
|
39
|
+
has_rdoc: true
|
42
40
|
homepage: http://github.com/nakajima/roleful
|
41
|
+
licenses: []
|
42
|
+
|
43
43
|
post_install_message:
|
44
44
|
rdoc_options: []
|
45
45
|
|
@@ -60,7 +60,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
60
60
|
requirements: []
|
61
61
|
|
62
62
|
rubyforge_project:
|
63
|
-
rubygems_version: 1.3.
|
63
|
+
rubygems_version: 1.3.5
|
64
64
|
signing_key:
|
65
65
|
specification_version: 2
|
66
66
|
summary: Generic roles for you and your objects
|