coerced_accessor 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -1
- data/lib/coerced_accessor.rb +1 -0
- data/lib/coerced_accessor/time.rb +1 -1
- data/lib/coerced_accessor/version.rb +1 -1
- data/spec/lib/time_spec.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2221ecad5891caadc531537eda79f84fdfbcf3dd
|
4
|
+
data.tar.gz: 884fa63efaccc599bb0bc1de989bc8c074422926
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 717636a2589d536bed119521805161c2d2c63e237a9e1af5cad9f32f9ad20d92790b6d1125ef86a9dcda53dc7d3e5ef341e4acdf5a93e393607f9b6d9e13b07d
|
7
|
+
data.tar.gz: ef1f708a2ac587d06a20cc52903d78fbb3dce14abd7dd6c0ff5684f7c4ddab44d558a175e1ec5e5c12155d0bf531bf5bc6346ebe037704faafb6c5a07a13011b
|
data/README.md
CHANGED
@@ -18,6 +18,8 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
## Human readable dates
|
20
20
|
|
21
|
+
Motivation: Rails Time.new = String can parse most date formats. On the other hand, if user inputs '12.01.2001' in text field - we should keep this value after form submission. Instead of this he will see `Time#to_s` result (`"2001-01-12 00:00:00 +0300"`) by default.
|
22
|
+
|
21
23
|
```ruby
|
22
24
|
class UserForm
|
23
25
|
extend CoercedAccessor::Time
|
@@ -52,7 +54,7 @@ class User < ActiveRecord::Base
|
|
52
54
|
extend CoercedAccessor::Compound
|
53
55
|
|
54
56
|
belongs_to :imageable
|
55
|
-
compound_accessor :imageable_formatted, :imageable_id, :imageable_type
|
57
|
+
compound_accessor :imageable_formatted, :imageable_id, :imageable_type, delimiter: ':'
|
56
58
|
end
|
57
59
|
|
58
60
|
user = User.new
|
data/lib/coerced_accessor.rb
CHANGED
data/spec/lib/time_spec.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: coerced_accessor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Viktor Sokolov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-06-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -126,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
126
126
|
version: '0'
|
127
127
|
requirements: []
|
128
128
|
rubyforge_project:
|
129
|
-
rubygems_version: 2.
|
129
|
+
rubygems_version: 2.4.8
|
130
130
|
signing_key:
|
131
131
|
specification_version: 4
|
132
132
|
summary: Provides object attribute aliases coercing values to/from human readable
|