semantic_attributes 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +2 -1
- data/lib/semantic_attributes/attribute_formats.rb +11 -6
- data/lib/semantic_attributes/version.rb +1 -1
- data/semantic_attributes.gemspec +2 -2
- metadata +4 -5
- data/Gemfile.lock +0 -94
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4f61914c744a168e768b8f1758b4a5105450c876
|
|
4
|
+
data.tar.gz: 4661dc4b0819fec9ba75f705cecf07693cebb766
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 42ff158e847d45e25336f827f77b248357cee54cdfb849ccc6060a5c4d6e0ff37ceab40e8785062e0f01332257b4a451e3a275b4b014481036f5ed120d004833
|
|
7
|
+
data.tar.gz: fe5f47dff95a3758c3a4a27988fff87221e6894a23187480ec02fc5dc7fc9d1bec496b6149f06998e95c69cd6a82263c0b06994039ac780c2345be74419a9b08
|
data/.gitignore
CHANGED
|
@@ -9,7 +9,7 @@ module SemanticAttributes #:nodoc:
|
|
|
9
9
|
def self.included(base)
|
|
10
10
|
base.extend ClassMethods
|
|
11
11
|
end
|
|
12
|
-
|
|
12
|
+
|
|
13
13
|
def respond_to?(method_name, *args)
|
|
14
14
|
if md = method_name.to_s.match(/_for_human$/) and semantic_attributes.include?(md.pre_match)
|
|
15
15
|
true
|
|
@@ -17,9 +17,9 @@ module SemanticAttributes #:nodoc:
|
|
|
17
17
|
super
|
|
18
18
|
end
|
|
19
19
|
end
|
|
20
|
-
|
|
20
|
+
|
|
21
21
|
protected
|
|
22
|
-
|
|
22
|
+
|
|
23
23
|
def method_missing(method_name, *args, &block)
|
|
24
24
|
if md = method_name.to_s.match(/_for_human$/) and semantic_attributes.include?(md.pre_match)
|
|
25
25
|
self.class.humanize(md.pre_match, self.send(md.pre_match))
|
|
@@ -44,12 +44,17 @@ module SemanticAttributes #:nodoc:
|
|
|
44
44
|
def normalize(attr, obj)
|
|
45
45
|
self.semantic_attributes[attr].predicates.inject(obj) { |val, predicate| val = predicate.normalize(val) }
|
|
46
46
|
end
|
|
47
|
-
|
|
47
|
+
|
|
48
48
|
protected
|
|
49
49
|
|
|
50
50
|
def define_normalization_method_for(attr)
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
if Gem::Version.new(::ActiveRecord::VERSION::STRING) >= Gem::Version.new("4.0.4")
|
|
52
|
+
# Changes from Rails 4.0.4: https://github.com/rails/rails/commit/714634ad02b443ab51f8ef3ded324de411715d2a
|
|
53
|
+
self.define_attribute_methods if !@attribute_methods_generated
|
|
54
|
+
else
|
|
55
|
+
self.define_attribute_methods if self.respond_to? :attribute_methods_generated? and !self.attribute_methods_generated?
|
|
56
|
+
end
|
|
57
|
+
|
|
53
58
|
writer = "#{attr}_with_normalization="
|
|
54
59
|
old_writer = "#{attr}_without_normalization=".to_sym
|
|
55
60
|
unless method_defined? writer
|
data/semantic_attributes.gemspec
CHANGED
|
@@ -9,10 +9,10 @@ Gem::Specification.new do |s|
|
|
|
9
9
|
s.authors = ["Lance Ivy"]
|
|
10
10
|
s.email = 'lance@kickstarter.com'
|
|
11
11
|
s.platform = Gem::Platform::RUBY
|
|
12
|
-
s.homepage = %q{http://github.com/
|
|
12
|
+
s.homepage = %q{http://github.com/cainlevy/semantic-attributes}
|
|
13
13
|
s.require_paths = ["lib"]
|
|
14
14
|
s.summary = 'A validation library for ActiveRecord models.'
|
|
15
|
-
s.description = 'A validation library for ActiveRecord models that allows ' +
|
|
15
|
+
s.description = 'A validation library for ActiveRecord models that allows ' +
|
|
16
16
|
'introspection (User.name_is_required?) and supports database' +
|
|
17
17
|
' normalization (aka "form input cleaning").'
|
|
18
18
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: semantic_attributes
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Lance Ivy
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2014-03-18 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|
|
@@ -89,7 +89,6 @@ extra_rdoc_files: []
|
|
|
89
89
|
files:
|
|
90
90
|
- .gitignore
|
|
91
91
|
- Gemfile
|
|
92
|
-
- Gemfile.lock
|
|
93
92
|
- MIT-LICENSE
|
|
94
93
|
- README
|
|
95
94
|
- Rakefile
|
|
@@ -161,7 +160,7 @@ files:
|
|
|
161
160
|
- test/unit/semantic_attribute_test.rb
|
|
162
161
|
- test/unit/semantic_attributes_test.rb
|
|
163
162
|
- test/unit/validations_test.rb
|
|
164
|
-
homepage: http://github.com/
|
|
163
|
+
homepage: http://github.com/cainlevy/semantic-attributes
|
|
165
164
|
licenses: []
|
|
166
165
|
metadata: {}
|
|
167
166
|
post_install_message:
|
|
@@ -180,7 +179,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
180
179
|
version: '0'
|
|
181
180
|
requirements: []
|
|
182
181
|
rubyforge_project:
|
|
183
|
-
rubygems_version: 2.
|
|
182
|
+
rubygems_version: 2.2.2
|
|
184
183
|
signing_key:
|
|
185
184
|
specification_version: 4
|
|
186
185
|
summary: A validation library for ActiveRecord models.
|
data/Gemfile.lock
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
PATH
|
|
2
|
-
remote: .
|
|
3
|
-
specs:
|
|
4
|
-
semantic_attributes (1.1.3)
|
|
5
|
-
rails (>= 3.2.13)
|
|
6
|
-
|
|
7
|
-
GEM
|
|
8
|
-
remote: http://rubygems.org/
|
|
9
|
-
specs:
|
|
10
|
-
actionmailer (4.0.0)
|
|
11
|
-
actionpack (= 4.0.0)
|
|
12
|
-
mail (~> 2.5.3)
|
|
13
|
-
actionpack (4.0.0)
|
|
14
|
-
activesupport (= 4.0.0)
|
|
15
|
-
builder (~> 3.1.0)
|
|
16
|
-
erubis (~> 2.7.0)
|
|
17
|
-
rack (~> 1.5.2)
|
|
18
|
-
rack-test (~> 0.6.2)
|
|
19
|
-
activemodel (4.0.0)
|
|
20
|
-
activesupport (= 4.0.0)
|
|
21
|
-
builder (~> 3.1.0)
|
|
22
|
-
activerecord (4.0.0)
|
|
23
|
-
activemodel (= 4.0.0)
|
|
24
|
-
activerecord-deprecated_finders (~> 1.0.2)
|
|
25
|
-
activesupport (= 4.0.0)
|
|
26
|
-
arel (~> 4.0.0)
|
|
27
|
-
activerecord-deprecated_finders (1.0.3)
|
|
28
|
-
activesupport (4.0.0)
|
|
29
|
-
i18n (~> 0.6, >= 0.6.4)
|
|
30
|
-
minitest (~> 4.2)
|
|
31
|
-
multi_json (~> 1.3)
|
|
32
|
-
thread_safe (~> 0.1)
|
|
33
|
-
tzinfo (~> 0.3.37)
|
|
34
|
-
arel (4.0.0)
|
|
35
|
-
atomic (1.1.10)
|
|
36
|
-
builder (3.1.4)
|
|
37
|
-
erubis (2.7.0)
|
|
38
|
-
hike (1.2.3)
|
|
39
|
-
i18n (0.6.4)
|
|
40
|
-
mail (2.5.4)
|
|
41
|
-
mime-types (~> 1.16)
|
|
42
|
-
treetop (~> 1.4.8)
|
|
43
|
-
metaclass (0.0.1)
|
|
44
|
-
mime-types (1.23)
|
|
45
|
-
minitest (4.7.5)
|
|
46
|
-
mocha (0.14.0)
|
|
47
|
-
metaclass (~> 0.0.1)
|
|
48
|
-
multi_json (1.7.7)
|
|
49
|
-
polyglot (0.3.3)
|
|
50
|
-
rack (1.5.2)
|
|
51
|
-
rack-test (0.6.2)
|
|
52
|
-
rack (>= 1.0)
|
|
53
|
-
rails (4.0.0)
|
|
54
|
-
actionmailer (= 4.0.0)
|
|
55
|
-
actionpack (= 4.0.0)
|
|
56
|
-
activerecord (= 4.0.0)
|
|
57
|
-
activesupport (= 4.0.0)
|
|
58
|
-
bundler (>= 1.3.0, < 2.0)
|
|
59
|
-
railties (= 4.0.0)
|
|
60
|
-
sprockets-rails (~> 2.0.0)
|
|
61
|
-
railties (4.0.0)
|
|
62
|
-
actionpack (= 4.0.0)
|
|
63
|
-
activesupport (= 4.0.0)
|
|
64
|
-
rake (>= 0.8.7)
|
|
65
|
-
thor (>= 0.18.1, < 2.0)
|
|
66
|
-
rake (0.8.7)
|
|
67
|
-
sprockets (2.10.0)
|
|
68
|
-
hike (~> 1.2)
|
|
69
|
-
multi_json (~> 1.0)
|
|
70
|
-
rack (~> 1.0)
|
|
71
|
-
tilt (~> 1.1, != 1.3.0)
|
|
72
|
-
sprockets-rails (2.0.0)
|
|
73
|
-
actionpack (>= 3.0)
|
|
74
|
-
activesupport (>= 3.0)
|
|
75
|
-
sprockets (~> 2.8)
|
|
76
|
-
sqlite3 (1.3.7)
|
|
77
|
-
thor (0.18.1)
|
|
78
|
-
thread_safe (0.1.0)
|
|
79
|
-
atomic
|
|
80
|
-
tilt (1.4.1)
|
|
81
|
-
treetop (1.4.14)
|
|
82
|
-
polyglot
|
|
83
|
-
polyglot (>= 0.3.1)
|
|
84
|
-
tzinfo (0.3.37)
|
|
85
|
-
|
|
86
|
-
PLATFORMS
|
|
87
|
-
ruby
|
|
88
|
-
|
|
89
|
-
DEPENDENCIES
|
|
90
|
-
bundler (>= 1.0.0)
|
|
91
|
-
mocha (>= 0.10.5)
|
|
92
|
-
rake (>= 0.8.7)
|
|
93
|
-
semantic_attributes!
|
|
94
|
-
sqlite3
|