meta_strf 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/meta_strf.rb +17 -15
- data/lib/meta_strf/version.rb +1 -1
- metadata +3 -3
data/lib/meta_strf.rb
CHANGED
@@ -1,23 +1,25 @@
|
|
1
1
|
module MetaStrf
|
2
|
-
|
3
|
-
|
2
|
+
module ActsAsMetaStrf
|
3
|
+
extend ActiveSupport::Concern
|
4
4
|
|
5
|
-
|
5
|
+
# included do
|
6
6
|
|
7
|
-
|
7
|
+
# end
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
module ClassMethods
|
10
|
+
def acts_as_meta_strf(options = {})
|
11
|
+
default_format = options[:default] || "%FT%T"
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
13
|
+
columns.reject{|column| column.type!=:datetime && column.type!=:date }.each do |column|
|
14
|
+
define_method("#{column.name.to_s}_strf") do
|
15
|
+
send(column.name).try(:strftime, default_format)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
21
23
|
end
|
22
24
|
|
23
25
|
|
data/lib/meta_strf/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: meta_strf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -115,7 +115,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
115
115
|
version: '0'
|
116
116
|
segments:
|
117
117
|
- 0
|
118
|
-
hash:
|
118
|
+
hash: 2769677696836080616
|
119
119
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
120
120
|
none: false
|
121
121
|
requirements:
|
@@ -124,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
124
124
|
version: '0'
|
125
125
|
segments:
|
126
126
|
- 0
|
127
|
-
hash:
|
127
|
+
hash: 2769677696836080616
|
128
128
|
requirements: []
|
129
129
|
rubyforge_project:
|
130
130
|
rubygems_version: 1.8.24
|