attributes 5.0.0 → 5.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README +13 -5
- data/README.tmpl +10 -5
- data/gemspec.rb +1 -1
- data/lib/attributes-5.0.0.rb +2 -2
- data/lib/attributes.rb +2 -2
- metadata +4 -12
data/README
CHANGED
@@ -5,8 +5,9 @@ INSTALL
|
|
5
5
|
gem install attributes
|
6
6
|
|
7
7
|
URIS
|
8
|
-
http://rubyforge.org/projects/codeforpeople/
|
9
8
|
http://codeforpeople.com/lib/ruby
|
9
|
+
http://rubyforge.org/projects/codeforpeople/
|
10
|
+
http://codeforpeople.rubyforge.org/svn/
|
10
11
|
|
11
12
|
SYNOPSIS
|
12
13
|
attributes.rb provides a set of attr_* like method with several user
|
@@ -42,9 +43,15 @@ SYNOPSIS
|
|
42
43
|
|
43
44
|
- getters acts as setters if an argument is given to them
|
44
45
|
|
46
|
+
- block caching, calling an attribute with a block sets the instance
|
47
|
+
variable to that block
|
48
|
+
|
45
49
|
all this in < 100 lines of code
|
46
50
|
|
47
51
|
HISTORY
|
52
|
+
5.0.1
|
53
|
+
- removed wrong dep on pervasives from gemspec.rb
|
54
|
+
|
48
55
|
5.0.0
|
49
56
|
- added support for block caching. for example
|
50
57
|
|
@@ -54,7 +61,9 @@ HISTORY
|
|
54
61
|
attribute :process
|
55
62
|
end
|
56
63
|
|
57
|
-
|
64
|
+
filter = Filter.new
|
65
|
+
|
66
|
+
filter.process{|line| line.upcase}
|
58
67
|
|
59
68
|
lines.each do |line|
|
60
69
|
p filter.process.call(line)
|
@@ -67,6 +76,7 @@ HISTORY
|
|
67
76
|
|
68
77
|
def migration_class
|
69
78
|
model = self
|
79
|
+
|
70
80
|
Class.new(::ActiveRecord::Migration) do
|
71
81
|
singleton_class =
|
72
82
|
class << self
|
@@ -86,7 +96,7 @@ HISTORY
|
|
86
96
|
migration do
|
87
97
|
def up
|
88
98
|
create_table model.table_name, :primary_key => model.primary_key do |t|
|
89
|
-
t.column '
|
99
|
+
t.column 'vinyl_shoes', :text
|
90
100
|
end
|
91
101
|
end
|
92
102
|
|
@@ -100,8 +110,6 @@ HISTORY
|
|
100
110
|
|
101
111
|
JobsMigration = Jobs.migration_class
|
102
112
|
|
103
|
-
- cleaned up some warnings under 'ruby -d'
|
104
|
-
|
105
113
|
4.1.0
|
106
114
|
- 4.0.0 introduced a bug where a query (foo?) would not initialize a var -
|
107
115
|
4.1.0 fixes that
|
data/README.tmpl
CHANGED
@@ -5,8 +5,9 @@ INSTALL
|
|
5
5
|
gem install attributes
|
6
6
|
|
7
7
|
URIS
|
8
|
-
http://rubyforge.org/projects/codeforpeople/
|
9
8
|
http://codeforpeople.com/lib/ruby
|
9
|
+
http://rubyforge.org/projects/codeforpeople/
|
10
|
+
http://codeforpeople.rubyforge.org/svn/
|
10
11
|
|
11
12
|
SYNOPSIS
|
12
13
|
attributes.rb provides a set of attr_* like method with several user
|
@@ -42,6 +43,9 @@ SYNOPSIS
|
|
42
43
|
|
43
44
|
- getters acts as setters if an argument is given to them
|
44
45
|
|
46
|
+
- block caching, calling an attribute with a block sets the instance
|
47
|
+
variable to that block
|
48
|
+
|
45
49
|
all this in < 100 lines of code
|
46
50
|
|
47
51
|
HISTORY
|
@@ -54,7 +58,9 @@ HISTORY
|
|
54
58
|
attribute :process
|
55
59
|
end
|
56
60
|
|
57
|
-
|
61
|
+
filter = Filter.new
|
62
|
+
|
63
|
+
filter.process{|line| line.upcase}
|
58
64
|
|
59
65
|
lines.each do |line|
|
60
66
|
p filter.process.call(line)
|
@@ -67,6 +73,7 @@ HISTORY
|
|
67
73
|
|
68
74
|
def migration_class
|
69
75
|
model = self
|
76
|
+
|
70
77
|
Class.new(::ActiveRecord::Migration) do
|
71
78
|
singleton_class =
|
72
79
|
class << self
|
@@ -86,7 +93,7 @@ HISTORY
|
|
86
93
|
migration do
|
87
94
|
def up
|
88
95
|
create_table model.table_name, :primary_key => model.primary_key do |t|
|
89
|
-
t.column '
|
96
|
+
t.column 'vinyl_shoes', :text
|
90
97
|
end
|
91
98
|
end
|
92
99
|
|
@@ -100,8 +107,6 @@ HISTORY
|
|
100
107
|
|
101
108
|
JobsMigration = Jobs.migration_class
|
102
109
|
|
103
|
-
- cleaned up some warnings under 'ruby -d'
|
104
|
-
|
105
110
|
4.1.0
|
106
111
|
- 4.0.0 introduced a bug where a query (foo?) would not initialize a var -
|
107
112
|
4.1.0 fixes that
|
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', '>= 1.0'
|
21
|
+
#spec.add_dependency 'pervasives', '>= 1.0'
|
22
22
|
|
23
23
|
spec.extensions << "extconf.rb" if File::exists? "extconf.rb"
|
24
24
|
|
data/lib/attributes-5.0.0.rb
CHANGED
@@ -40,7 +40,7 @@ module Attributes
|
|
40
40
|
|
41
41
|
initialize = b || lambda { default }
|
42
42
|
initializer = lambda do |this|
|
43
|
-
Object.instance_method('instance_eval').bind(this).call
|
43
|
+
Object.instance_method('instance_eval').bind(this).call &initialize
|
44
44
|
end
|
45
45
|
initializer_id = initializer.object_id
|
46
46
|
__attributes__.initializers[name] = initializer
|
@@ -108,7 +108,7 @@ class Object
|
|
108
108
|
class << self
|
109
109
|
self
|
110
110
|
end
|
111
|
-
sc.attributes
|
111
|
+
sc.attributes *a, &b
|
112
112
|
end
|
113
113
|
%w( __attributes__ __attribute__ attribute ).each{|dst| alias_method dst, 'attributes'}
|
114
114
|
end
|
data/lib/attributes.rb
CHANGED
@@ -40,7 +40,7 @@ module Attributes
|
|
40
40
|
|
41
41
|
initialize = b || lambda { default }
|
42
42
|
initializer = lambda do |this|
|
43
|
-
Object.instance_method('instance_eval').bind(this).call
|
43
|
+
Object.instance_method('instance_eval').bind(this).call &initialize
|
44
44
|
end
|
45
45
|
initializer_id = initializer.object_id
|
46
46
|
__attributes__.initializers[name] = initializer
|
@@ -108,7 +108,7 @@ class Object
|
|
108
108
|
class << self
|
109
109
|
self
|
110
110
|
end
|
111
|
-
sc.attributes
|
111
|
+
sc.attributes *a, &b
|
112
112
|
end
|
113
113
|
%w( __attributes__ __attribute__ attribute ).each{|dst| alias_method dst, 'attributes'}
|
114
114
|
end
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4
|
|
3
3
|
specification_version: 1
|
4
4
|
name: attributes
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 5.0.
|
7
|
-
date: 2007-
|
6
|
+
version: 5.0.1
|
7
|
+
date: 2007-12-12 00:00:00 -07:00
|
8
8
|
summary: attributes
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -58,13 +58,5 @@ extensions: []
|
|
58
58
|
|
59
59
|
requirements: []
|
60
60
|
|
61
|
-
dependencies:
|
62
|
-
|
63
|
-
name: pervasives
|
64
|
-
version_requirement:
|
65
|
-
version_requirements: !ruby/object:Gem::Version::Requirement
|
66
|
-
requirements:
|
67
|
-
- - ">="
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
version: "1.0"
|
70
|
-
version:
|
61
|
+
dependencies: []
|
62
|
+
|