attribute_column 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/attribute_column.rb +2 -2
- data/lib/attribute_column/version.rb +1 -1
- data/spec/attribute_column_spec.rb +8 -0
- metadata +4 -4
data/lib/attribute_column.rb
CHANGED
@@ -28,11 +28,11 @@ module AttributeColumn
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def attribute_column(name, attribute_type)
|
31
|
-
columns_hash[name] = AttributeColumn.generate({name: name, type: attribute_type})
|
31
|
+
columns_hash[name.to_sym] = AttributeColumn.generate({name: name, type: attribute_type})
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
35
|
def column_for_attribute(attribute)
|
36
|
-
self.class.columns_hash[attribute]
|
36
|
+
self.class.columns_hash[attribute.to_sym]
|
37
37
|
end
|
38
38
|
end
|
@@ -34,5 +34,13 @@ describe AttributeColumn do
|
|
34
34
|
columned_class.attribute_column(:title, :string)
|
35
35
|
columned.column_for_attribute(:title).type.must_equal :string
|
36
36
|
end
|
37
|
+
|
38
|
+
it "should be tollerant of string/sybol mismatches" do
|
39
|
+
columned_class.attribute_column(:b, :binary)
|
40
|
+
columned_class.attribute_column("d", :date)
|
41
|
+
|
42
|
+
columned.column_for_attribute("b").type.must_equal :binary
|
43
|
+
columned.column_for_attribute(:d).type.must_equal :date
|
44
|
+
end
|
37
45
|
end
|
38
46
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: attribute_column
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-06-
|
12
|
+
date: 2013-06-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: actionpack
|
@@ -93,7 +93,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
93
93
|
version: '0'
|
94
94
|
segments:
|
95
95
|
- 0
|
96
|
-
hash: -
|
96
|
+
hash: -3769432995051110609
|
97
97
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
98
98
|
none: false
|
99
99
|
requirements:
|
@@ -102,7 +102,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
102
102
|
version: '0'
|
103
103
|
segments:
|
104
104
|
- 0
|
105
|
-
hash: -
|
105
|
+
hash: -3769432995051110609
|
106
106
|
requirements: []
|
107
107
|
rubyforge_project:
|
108
108
|
rubygems_version: 1.8.25
|