weighable 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/weighable/version.rb +1 -1
- data/lib/weighable/weight.rb +6 -1
- 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: 22b72cd81615daf077cd108b83102ef4c95cef9e
|
|
4
|
+
data.tar.gz: d59754f8f2c5b562baa29fd713ed91fa7c56e558
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e7657e1bd1475b810902f98dfdb5706b06d42c265c725b978de734158552153c40cec1e4ded21a2ba6b97bf9e58dccf2dd0327b29414e3f4e02463c9d698e7e1
|
|
7
|
+
data.tar.gz: 2de51ed4b88d532034fe71e98812bc3fdca2fdc54fd95479519dd9a624925afddfe9cfaa4ab18159806d5f9120c13b9efa45ad9403cd446674cdd58046eb2fe1
|
data/lib/weighable/version.rb
CHANGED
data/lib/weighable/weight.rb
CHANGED
|
@@ -107,11 +107,16 @@ module Weighable
|
|
|
107
107
|
|
|
108
108
|
UNIT.keys.each do |unit|
|
|
109
109
|
unit = unit.to_s
|
|
110
|
+
plural = ActiveSupport::Inflector.pluralize(unit)
|
|
110
111
|
define_method "to_#{unit}" do
|
|
111
112
|
to(unit)
|
|
112
113
|
end
|
|
113
|
-
plural = ActiveSupport::Inflector.pluralize(unit)
|
|
114
114
|
alias_method "to_#{plural}", "to_#{unit}" unless unit == plural
|
|
115
|
+
|
|
116
|
+
define_method "is_#{unit}?" do
|
|
117
|
+
@unit == unit_from_symbol(unit.to_sym)
|
|
118
|
+
end
|
|
119
|
+
alias_method "is_#{plural}?", "is_#{unit}?" unless unit == plural
|
|
115
120
|
end
|
|
116
121
|
|
|
117
122
|
def to_s(only_unit: false)
|
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.5.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-04-
|
|
11
|
+
date: 2016-04-07 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|