weighable 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/weighable/version.rb +1 -1
- data/lib/weighable/weight.rb +29 -9
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 984709117b437eb9982b3d09d02ad28c1d90db7c
|
4
|
+
data.tar.gz: b2db20e28dc3c33d07a9d839406bffe12f855ca3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a7163b31cff91894c4c70f71005a40cca2b2e65869f943a17906d4798512a790d497c35e3b8bf1a5e15f2420c60d3b5536ca23ef441fd409bd822a381c652d82
|
7
|
+
data.tar.gz: 335eb71d98c7445638c5ef2911251f495af0d314e8a614532909be22d428889ec9e883867d3bf8959a4f98eb6bb2319d02abb62a3b7bd2986c75a2ded9de53fd
|
data/lib/weighable/version.rb
CHANGED
data/lib/weighable/weight.rb
CHANGED
@@ -111,10 +111,6 @@ module Weighable
|
|
111
111
|
end
|
112
112
|
end
|
113
113
|
|
114
|
-
def ==(other)
|
115
|
-
other.class == self.class && other.value == @value && other.unit == @unit
|
116
|
-
end
|
117
|
-
|
118
114
|
def +(other)
|
119
115
|
other = other.to(unit_name)
|
120
116
|
Weight.new(@value + other.value, unit_name)
|
@@ -130,16 +126,40 @@ module Weighable
|
|
130
126
|
Weight.new(@value * other.value, unit_name)
|
131
127
|
end
|
132
128
|
|
133
|
-
def round(precision = 0)
|
134
|
-
@value = @value.round(precision)
|
135
|
-
self
|
136
|
-
end
|
137
|
-
|
138
129
|
def /(other)
|
139
130
|
other = other.to(unit_name)
|
140
131
|
Weight.new(@value / other.value, unit_name)
|
141
132
|
end
|
142
133
|
|
134
|
+
def ==(other)
|
135
|
+
other.class == self.class && other.value == @value && other.unit == @unit
|
136
|
+
end
|
137
|
+
|
138
|
+
def <(other)
|
139
|
+
other = other.to(unit_name)
|
140
|
+
@value < other.value
|
141
|
+
end
|
142
|
+
|
143
|
+
def <=(other)
|
144
|
+
other = other.to(unit_name)
|
145
|
+
@value <= other.value
|
146
|
+
end
|
147
|
+
|
148
|
+
def >(other)
|
149
|
+
other = other.to(unit_name)
|
150
|
+
@value > other.value
|
151
|
+
end
|
152
|
+
|
153
|
+
def >=(other)
|
154
|
+
other = other.to(unit_name)
|
155
|
+
@value >= other.value
|
156
|
+
end
|
157
|
+
|
158
|
+
def round(precision = 0)
|
159
|
+
@value = @value.round(precision)
|
160
|
+
self
|
161
|
+
end
|
162
|
+
|
143
163
|
private
|
144
164
|
|
145
165
|
def unit_name
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: weighable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Trae Robrock
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-03-
|
11
|
+
date: 2016-03-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|