attributes 3.5.0 → 3.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/{attributes-3.5.0.gem → attributes-3.6.0.gem} +0 -0
- data/gemspec.rb +1 -1
- data/lib/{attributes-3.5.0.rb → attributes-3.6.0.rb} +47 -3
- data/lib/attributes.rb +47 -3
- metadata +5 -6
- data/a.rb +0 -14
File without changes
|
data/gemspec.rb
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification::new do |spec|
|
|
18
18
|
|
19
19
|
spec.has_rdoc = File::exist? "doc"
|
20
20
|
spec.test_suite_file = "test/#{ lib }.rb" if File::directory? "test"
|
21
|
-
spec.add_dependency 'pervasives', '>= 0'
|
21
|
+
spec.add_dependency 'pervasives', '>= 1.0'
|
22
22
|
|
23
23
|
spec.extensions << "extconf.rb" if File::exists? "extconf.rb"
|
24
24
|
|
@@ -1,7 +1,5 @@
|
|
1
|
-
require 'pervasives'
|
2
|
-
|
3
1
|
module Attributes
|
4
|
-
VERSION = '3.
|
2
|
+
VERSION = '3.6.0'
|
5
3
|
def self.version() VERSION end
|
6
4
|
|
7
5
|
def attributes *a, &b
|
@@ -17,6 +15,8 @@ module Attributes
|
|
17
15
|
ivar, getter, setter, query, banger =
|
18
16
|
"@#{ name }", "#{ name }", "#{ name }=", "#{ name }?", "#{ name }!"
|
19
17
|
|
18
|
+
raise NameError, "bad instance variable name '#{ ivar }'" if ivar =~ %r/[!?=]$/o
|
19
|
+
|
20
20
|
define_method(setter) do |value|
|
21
21
|
__pervasive__('instance_variable_set', ivar, value)
|
22
22
|
end
|
@@ -77,3 +77,47 @@ end
|
|
77
77
|
class Module
|
78
78
|
include Attributes
|
79
79
|
end
|
80
|
+
|
81
|
+
BEGIN {
|
82
|
+
unless defined? Pervasives
|
83
|
+
begin
|
84
|
+
require 'pervasives'
|
85
|
+
rescue LoadError
|
86
|
+
module Pervasives
|
87
|
+
VERSION = "1.0.0"
|
88
|
+
def self.version() VERSION end
|
89
|
+
class ::Class
|
90
|
+
def __pervasive__ m, *a, &b
|
91
|
+
(( Class.instance_method(m) rescue
|
92
|
+
Module.instance_method(m) rescue
|
93
|
+
Object.instance_method(m) )).bind(self).call(*a, &b)
|
94
|
+
end
|
95
|
+
end
|
96
|
+
class ::Module
|
97
|
+
def __pervasive__ m, *a, &b
|
98
|
+
(( Module.instance_method(m) rescue
|
99
|
+
Object.instance_method(m) )).bind(self).call(*a, &b)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
class ::Object
|
103
|
+
def __pervasive__ m, *a, &b
|
104
|
+
(( Object.instance_method(m) )).bind(self).call(*a, &b)
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
class Proxy
|
109
|
+
instance_methods.each{|m| undef_method m unless m[%r/__/]}
|
110
|
+
def initialize obj
|
111
|
+
@obj = obj
|
112
|
+
end
|
113
|
+
def method_missing m, *a, &b
|
114
|
+
@obj.__pervasive__ m, *a, &b
|
115
|
+
end
|
116
|
+
def __obj__
|
117
|
+
@obj
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
}
|
data/lib/attributes.rb
CHANGED
@@ -1,7 +1,5 @@
|
|
1
|
-
require 'pervasives'
|
2
|
-
|
3
1
|
module Attributes
|
4
|
-
VERSION = '3.
|
2
|
+
VERSION = '3.6.0'
|
5
3
|
def self.version() VERSION end
|
6
4
|
|
7
5
|
def attributes *a, &b
|
@@ -17,6 +15,8 @@ module Attributes
|
|
17
15
|
ivar, getter, setter, query, banger =
|
18
16
|
"@#{ name }", "#{ name }", "#{ name }=", "#{ name }?", "#{ name }!"
|
19
17
|
|
18
|
+
raise NameError, "bad instance variable name '#{ ivar }'" if ivar =~ %r/[!?=]$/o
|
19
|
+
|
20
20
|
define_method(setter) do |value|
|
21
21
|
__pervasive__('instance_variable_set', ivar, value)
|
22
22
|
end
|
@@ -77,3 +77,47 @@ end
|
|
77
77
|
class Module
|
78
78
|
include Attributes
|
79
79
|
end
|
80
|
+
|
81
|
+
BEGIN {
|
82
|
+
unless defined? Pervasives
|
83
|
+
begin
|
84
|
+
require 'pervasives'
|
85
|
+
rescue LoadError
|
86
|
+
module Pervasives
|
87
|
+
VERSION = "1.0.0"
|
88
|
+
def self.version() VERSION end
|
89
|
+
class ::Class
|
90
|
+
def __pervasive__ m, *a, &b
|
91
|
+
(( Class.instance_method(m) rescue
|
92
|
+
Module.instance_method(m) rescue
|
93
|
+
Object.instance_method(m) )).bind(self).call(*a, &b)
|
94
|
+
end
|
95
|
+
end
|
96
|
+
class ::Module
|
97
|
+
def __pervasive__ m, *a, &b
|
98
|
+
(( Module.instance_method(m) rescue
|
99
|
+
Object.instance_method(m) )).bind(self).call(*a, &b)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
class ::Object
|
103
|
+
def __pervasive__ m, *a, &b
|
104
|
+
(( Object.instance_method(m) )).bind(self).call(*a, &b)
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
class Proxy
|
109
|
+
instance_methods.each{|m| undef_method m unless m[%r/__/]}
|
110
|
+
def initialize obj
|
111
|
+
@obj = obj
|
112
|
+
end
|
113
|
+
def method_missing m, *a, &b
|
114
|
+
@obj.__pervasive__ m, *a, &b
|
115
|
+
end
|
116
|
+
def __obj__
|
117
|
+
@obj
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
}
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.2
|
|
3
3
|
specification_version: 1
|
4
4
|
name: attributes
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 3.
|
7
|
-
date: 2007-
|
6
|
+
version: 3.6.0
|
7
|
+
date: 2007-09-08 00:00:00 -06:00
|
8
8
|
summary: attributes
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -29,13 +29,12 @@ post_install_message:
|
|
29
29
|
authors:
|
30
30
|
- Ara T. Howard
|
31
31
|
files:
|
32
|
-
-
|
33
|
-
- attributes-3.5.0.gem
|
32
|
+
- attributes-3.6.0.gem
|
34
33
|
- gemspec.rb
|
35
34
|
- gen_readme.rb
|
36
35
|
- install.rb
|
37
36
|
- lib
|
38
|
-
- lib/attributes-3.
|
37
|
+
- lib/attributes-3.6.0.rb
|
39
38
|
- lib/attributes.rb
|
40
39
|
- README
|
41
40
|
- README.tmpl
|
@@ -65,5 +64,5 @@ dependencies:
|
|
65
64
|
requirements:
|
66
65
|
- - ">="
|
67
66
|
- !ruby/object:Gem::Version
|
68
|
-
version: "0"
|
67
|
+
version: "1.0"
|
69
68
|
version:
|