structural 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/structural/model/type_casts.rb +12 -0
- data/lib/structural/version.rb +1 -1
- data/spec/lib/structural/model/type_casts_spec.rb +8 -0
- metadata +127 -105
- checksums.yaml +0 -7
@@ -61,6 +61,18 @@ module Structural
|
|
61
61
|
TypeCasts.register(self)
|
62
62
|
end
|
63
63
|
|
64
|
+
class Float < Cast
|
65
|
+
def self.type
|
66
|
+
::Float
|
67
|
+
end
|
68
|
+
|
69
|
+
def conversion
|
70
|
+
value.to_f
|
71
|
+
end
|
72
|
+
|
73
|
+
TypeCasts.register(self)
|
74
|
+
end
|
75
|
+
|
64
76
|
class Date < Cast
|
65
77
|
def self.type
|
66
78
|
::Date
|
data/lib/structural/version.rb
CHANGED
@@ -22,6 +22,14 @@ module Structural
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
+
describe Float do
|
26
|
+
subject { Float.new("2.0").cast }
|
27
|
+
|
28
|
+
it 'casts strings to floats' do
|
29
|
+
expect(subject).to eql(2.0)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
25
33
|
describe Date do
|
26
34
|
it 'casts strings to dates' do
|
27
35
|
Date.new("06-06-1983").cast.should eq ::Date.new(1983, 6, 6)
|
metadata
CHANGED
@@ -1,125 +1,138 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: structural
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 25
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 3
|
10
|
+
version: 0.0.3
|
5
11
|
platform: ruby
|
6
|
-
authors:
|
12
|
+
authors:
|
7
13
|
- Russell Dunphy
|
8
14
|
- Radek Molenda
|
9
15
|
- Jon Doveston
|
10
16
|
autorequire:
|
11
17
|
bindir: bin
|
12
18
|
cert_chain: []
|
13
|
-
|
14
|
-
|
15
|
-
|
19
|
+
|
20
|
+
date: 2014-11-11 00:00:00 +00:00
|
21
|
+
default_executable:
|
22
|
+
dependencies:
|
23
|
+
- !ruby/object:Gem::Dependency
|
16
24
|
name: money
|
17
|
-
requirement: !ruby/object:Gem::Requirement
|
18
|
-
requirements:
|
19
|
-
- - ">="
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: '0'
|
22
|
-
type: :runtime
|
23
25
|
prerelease: false
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
version: '0'
|
29
|
-
- !ruby/object:Gem::Dependency
|
30
|
-
name: activesupport
|
31
|
-
requirement: !ruby/object:Gem::Requirement
|
32
|
-
requirements:
|
26
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
27
|
+
none: false
|
28
|
+
requirements:
|
33
29
|
- - ">="
|
34
|
-
- !ruby/object:Gem::Version
|
35
|
-
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
hash: 3
|
32
|
+
segments:
|
33
|
+
- 0
|
34
|
+
version: "0"
|
36
35
|
type: :runtime
|
36
|
+
version_requirements: *id001
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: activesupport
|
37
39
|
prerelease: false
|
38
|
-
|
39
|
-
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
40
43
|
- - ">="
|
41
|
-
- !ruby/object:Gem::Version
|
42
|
-
|
43
|
-
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
hash: 3
|
46
|
+
segments:
|
47
|
+
- 0
|
48
|
+
version: "0"
|
49
|
+
type: :runtime
|
50
|
+
version_requirements: *id002
|
51
|
+
- !ruby/object:Gem::Dependency
|
44
52
|
name: rspec
|
45
|
-
requirement: !ruby/object:Gem::Requirement
|
46
|
-
requirements:
|
47
|
-
- - "~>"
|
48
|
-
- !ruby/object:Gem::Version
|
49
|
-
version: '3.0'
|
50
|
-
type: :development
|
51
53
|
prerelease: false
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
- !ruby/object:Gem::Version
|
63
|
-
version: '0'
|
54
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
55
|
+
none: false
|
56
|
+
requirements:
|
57
|
+
- - ~>
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
hash: 7
|
60
|
+
segments:
|
61
|
+
- 3
|
62
|
+
- 0
|
63
|
+
version: "3.0"
|
64
64
|
type: :development
|
65
|
+
version_requirements: *id003
|
66
|
+
- !ruby/object:Gem::Dependency
|
67
|
+
name: yard
|
65
68
|
prerelease: false
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
- !ruby/object:Gem::Version
|
70
|
-
version: '0'
|
71
|
-
- !ruby/object:Gem::Dependency
|
72
|
-
name: redcarpet
|
73
|
-
requirement: !ruby/object:Gem::Requirement
|
74
|
-
requirements:
|
69
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
70
|
+
none: false
|
71
|
+
requirements:
|
75
72
|
- - ">="
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
-
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
hash: 3
|
75
|
+
segments:
|
76
|
+
- 0
|
77
|
+
version: "0"
|
78
78
|
type: :development
|
79
|
+
version_requirements: *id004
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: redcarpet
|
79
82
|
prerelease: false
|
80
|
-
|
81
|
-
|
83
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
84
|
+
none: false
|
85
|
+
requirements:
|
82
86
|
- - ">="
|
83
|
-
- !ruby/object:Gem::Version
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
requirements:
|
89
|
-
- - "~>"
|
90
|
-
- !ruby/object:Gem::Version
|
91
|
-
version: '1.6'
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
hash: 3
|
89
|
+
segments:
|
90
|
+
- 0
|
91
|
+
version: "0"
|
92
92
|
type: :development
|
93
|
+
version_requirements: *id005
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: bundler
|
93
96
|
prerelease: false
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
- !ruby/object:Gem::Version
|
105
|
-
version: '0'
|
97
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
98
|
+
none: false
|
99
|
+
requirements:
|
100
|
+
- - ~>
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
hash: 3
|
103
|
+
segments:
|
104
|
+
- 1
|
105
|
+
- 6
|
106
|
+
version: "1.6"
|
106
107
|
type: :development
|
108
|
+
version_requirements: *id006
|
109
|
+
- !ruby/object:Gem::Dependency
|
110
|
+
name: rake
|
107
111
|
prerelease: false
|
108
|
-
|
109
|
-
|
112
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
110
115
|
- - ">="
|
111
|
-
- !ruby/object:Gem::Version
|
112
|
-
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
hash: 3
|
118
|
+
segments:
|
119
|
+
- 0
|
120
|
+
version: "0"
|
121
|
+
type: :development
|
122
|
+
version_requirements: *id007
|
113
123
|
description: A cut down fork of the Id gem developed at On The Beach Ltd.
|
114
|
-
email:
|
124
|
+
email:
|
115
125
|
- jon.doveston@onthebeach.co.uk
|
116
126
|
executables: []
|
127
|
+
|
117
128
|
extensions: []
|
129
|
+
|
118
130
|
extra_rdoc_files: []
|
119
|
-
|
120
|
-
|
121
|
-
-
|
122
|
-
-
|
131
|
+
|
132
|
+
files:
|
133
|
+
- .gitignore
|
134
|
+
- .ruby-version
|
135
|
+
- .travis.yml
|
123
136
|
- CONTRIBUTING.md
|
124
137
|
- Gemfile
|
125
138
|
- LICENSE.md
|
@@ -145,35 +158,44 @@ files:
|
|
145
158
|
- spec/lib/structural/timestamps_spec.rb
|
146
159
|
- spec/spec_helper.rb
|
147
160
|
- structural.gemspec
|
161
|
+
has_rdoc: true
|
148
162
|
homepage: https://github.com/onthebeach/structural
|
149
|
-
licenses:
|
163
|
+
licenses:
|
150
164
|
- MIT
|
151
|
-
metadata: {}
|
152
165
|
post_install_message:
|
153
166
|
rdoc_options: []
|
154
|
-
|
167
|
+
|
168
|
+
require_paths:
|
155
169
|
- lib
|
156
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
157
|
-
|
170
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
171
|
+
none: false
|
172
|
+
requirements:
|
158
173
|
- - ">="
|
159
|
-
- !ruby/object:Gem::Version
|
160
|
-
|
161
|
-
|
162
|
-
|
174
|
+
- !ruby/object:Gem::Version
|
175
|
+
hash: 3
|
176
|
+
segments:
|
177
|
+
- 0
|
178
|
+
version: "0"
|
179
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
180
|
+
none: false
|
181
|
+
requirements:
|
163
182
|
- - ">="
|
164
|
-
- !ruby/object:Gem::Version
|
165
|
-
|
183
|
+
- !ruby/object:Gem::Version
|
184
|
+
hash: 3
|
185
|
+
segments:
|
186
|
+
- 0
|
187
|
+
version: "0"
|
166
188
|
requirements: []
|
189
|
+
|
167
190
|
rubyforge_project:
|
168
|
-
rubygems_version:
|
191
|
+
rubygems_version: 1.3.7
|
169
192
|
signing_key:
|
170
|
-
specification_version:
|
193
|
+
specification_version: 3
|
171
194
|
summary: Simple models based on hashes
|
172
|
-
test_files:
|
195
|
+
test_files:
|
173
196
|
- spec/lib/structural/model/association_spec.rb
|
174
197
|
- spec/lib/structural/model/field_spec.rb
|
175
198
|
- spec/lib/structural/model/type_casts_spec.rb
|
176
199
|
- spec/lib/structural/model_spec.rb
|
177
200
|
- spec/lib/structural/timestamps_spec.rb
|
178
201
|
- spec/spec_helper.rb
|
179
|
-
has_rdoc:
|
checksums.yaml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: 42ac80a5771a583931812763ee42e0d39fd8f9f0
|
4
|
-
data.tar.gz: 9cb8858170f25c56324ebc9fe11b286ba06780b3
|
5
|
-
SHA512:
|
6
|
-
metadata.gz: b729b62062df2b8851711c5cf4ec5bf21b99c4a5e7e07da9e2f9d190fd8cea839ade128dd28481fcb6fedb8651f2ddab8df1e679483558049139d85e2d1d0b9d
|
7
|
-
data.tar.gz: 6f4b356480d4734ca322a2e9a019e88ffdae0c82b3911620d0a2b6beb2b3c7c6d30e3742a558e86b0a7c1f624a4a9c1ae9a089751f63114c0127af519f5c22d4
|