convertable_values 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/convertable_values.gemspec +5 -4
- data/lib/convertable_values.rb +1 -0
- metadata +23 -34
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.2
|
data/convertable_values.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{convertable_values}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Stephen Blankenship"]
|
12
|
-
s.date = %q{2011-
|
12
|
+
s.date = %q{2011-09-01}
|
13
13
|
s.description = %q{Convertable Values provides a simple unit conversion library and pattern for transparently storing base units.
|
14
14
|
Example usage: You have a model that wants to store values with units (e.g., 200 lbs), but you want (or at least should want)
|
15
15
|
to store all the values in a base unit (e.g., 90.718474 kilograms). This gem makes using this design pattern totally transparent.}
|
@@ -35,7 +35,7 @@ Gem::Specification.new do |s|
|
|
35
35
|
s.homepage = %q{http://github.com/stephenb/convertable_values}
|
36
36
|
s.licenses = ["MIT"]
|
37
37
|
s.require_paths = ["lib"]
|
38
|
-
s.rubygems_version = %q{1.
|
38
|
+
s.rubygems_version = %q{1.3.6}
|
39
39
|
s.summary = %q{Convertable Values provides a simple unit conversion library and pattern for transparently storing base units.}
|
40
40
|
s.test_files = [
|
41
41
|
"test/helper.rb",
|
@@ -43,9 +43,10 @@ Gem::Specification.new do |s|
|
|
43
43
|
]
|
44
44
|
|
45
45
|
if s.respond_to? :specification_version then
|
46
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
46
47
|
s.specification_version = 3
|
47
48
|
|
48
|
-
if Gem::Version.new(Gem::
|
49
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
49
50
|
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
50
51
|
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
51
52
|
s.add_development_dependency(%q<jeweler>, ["~> 1.5.1"])
|
data/lib/convertable_values.rb
CHANGED
@@ -14,6 +14,7 @@ module ConvertableValues
|
|
14
14
|
def convert(value_attr, unit_attr)
|
15
15
|
# Create override method for converting value to base unit when set
|
16
16
|
define_method "#{value_attr}=".to_sym do |new_value|
|
17
|
+
new_value = new_value.to_f if new_value.is_a?(String)
|
17
18
|
unit_str = send(unit_attr.to_sym)
|
18
19
|
|
19
20
|
if new_value && unit_str
|
metadata
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: convertable_values
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
4
|
+
prerelease: false
|
6
5
|
segments:
|
7
6
|
- 0
|
8
7
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
8
|
+
- 2
|
9
|
+
version: 0.1.2
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- Stephen Blankenship
|
@@ -15,68 +14,61 @@ autorequire:
|
|
15
14
|
bindir: bin
|
16
15
|
cert_chain: []
|
17
16
|
|
18
|
-
date: 2011-
|
17
|
+
date: 2011-09-01 00:00:00 -05:00
|
18
|
+
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
|
-
|
22
|
-
|
21
|
+
prerelease: false
|
22
|
+
name: shoulda
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
23
24
|
requirements:
|
24
25
|
- - ">="
|
25
26
|
- !ruby/object:Gem::Version
|
26
|
-
hash: 3
|
27
27
|
segments:
|
28
28
|
- 0
|
29
29
|
version: "0"
|
30
|
-
name: shoulda
|
31
|
-
prerelease: false
|
32
30
|
type: :development
|
33
|
-
|
31
|
+
version_requirements: *id001
|
34
32
|
- !ruby/object:Gem::Dependency
|
35
|
-
|
36
|
-
|
33
|
+
prerelease: false
|
34
|
+
name: bundler
|
35
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
37
36
|
requirements:
|
38
37
|
- - ~>
|
39
38
|
- !ruby/object:Gem::Version
|
40
|
-
hash: 23
|
41
39
|
segments:
|
42
40
|
- 1
|
43
41
|
- 0
|
44
42
|
- 0
|
45
43
|
version: 1.0.0
|
46
|
-
name: bundler
|
47
|
-
prerelease: false
|
48
44
|
type: :development
|
49
|
-
|
45
|
+
version_requirements: *id002
|
50
46
|
- !ruby/object:Gem::Dependency
|
51
|
-
|
52
|
-
|
47
|
+
prerelease: false
|
48
|
+
name: jeweler
|
49
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
53
50
|
requirements:
|
54
51
|
- - ~>
|
55
52
|
- !ruby/object:Gem::Version
|
56
|
-
hash: 1
|
57
53
|
segments:
|
58
54
|
- 1
|
59
55
|
- 5
|
60
56
|
- 1
|
61
57
|
version: 1.5.1
|
62
|
-
name: jeweler
|
63
|
-
prerelease: false
|
64
58
|
type: :development
|
65
|
-
|
59
|
+
version_requirements: *id003
|
66
60
|
- !ruby/object:Gem::Dependency
|
67
|
-
|
68
|
-
|
61
|
+
prerelease: false
|
62
|
+
name: rcov
|
63
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
69
64
|
requirements:
|
70
65
|
- - ">="
|
71
66
|
- !ruby/object:Gem::Version
|
72
|
-
hash: 3
|
73
67
|
segments:
|
74
68
|
- 0
|
75
69
|
version: "0"
|
76
|
-
name: rcov
|
77
|
-
prerelease: false
|
78
70
|
type: :development
|
79
|
-
|
71
|
+
version_requirements: *id004
|
80
72
|
description: |-
|
81
73
|
Convertable Values provides a simple unit conversion library and pattern for transparently storing base units.
|
82
74
|
Example usage: You have a model that wants to store values with units (e.g., 200 lbs), but you want (or at least should want)
|
@@ -102,6 +94,7 @@ files:
|
|
102
94
|
- lib/numeric/numeric_units.rb
|
103
95
|
- test/helper.rb
|
104
96
|
- test/test_convertable_values.rb
|
97
|
+
has_rdoc: true
|
105
98
|
homepage: http://github.com/stephenb/convertable_values
|
106
99
|
licenses:
|
107
100
|
- MIT
|
@@ -111,27 +104,23 @@ rdoc_options: []
|
|
111
104
|
require_paths:
|
112
105
|
- lib
|
113
106
|
required_ruby_version: !ruby/object:Gem::Requirement
|
114
|
-
none: false
|
115
107
|
requirements:
|
116
108
|
- - ">="
|
117
109
|
- !ruby/object:Gem::Version
|
118
|
-
hash: 3
|
119
110
|
segments:
|
120
111
|
- 0
|
121
112
|
version: "0"
|
122
113
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
123
|
-
none: false
|
124
114
|
requirements:
|
125
115
|
- - ">="
|
126
116
|
- !ruby/object:Gem::Version
|
127
|
-
hash: 3
|
128
117
|
segments:
|
129
118
|
- 0
|
130
119
|
version: "0"
|
131
120
|
requirements: []
|
132
121
|
|
133
122
|
rubyforge_project:
|
134
|
-
rubygems_version: 1.
|
123
|
+
rubygems_version: 1.3.6
|
135
124
|
signing_key:
|
136
125
|
specification_version: 3
|
137
126
|
summary: Convertable Values provides a simple unit conversion library and pattern for transparently storing base units.
|