weighable 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c03bc3a4ff0bfd00b9d109976a410d2f388655f5
4
- data.tar.gz: 360fc90c09b6d6a7a6201ec7b145cac15f9d8f0c
3
+ metadata.gz: 22b72cd81615daf077cd108b83102ef4c95cef9e
4
+ data.tar.gz: d59754f8f2c5b562baa29fd713ed91fa7c56e558
5
5
  SHA512:
6
- metadata.gz: 0b331cea39251b48e885f9a829f9bb843694c6bc111b11460dc31a40875255e3e4bdbb87fd8c4b953b370e4e4589d25f977bb928be1004f4221c9843fdf4a736
7
- data.tar.gz: 851a333bb993776932edf2ee5109e08e87310ba0ae3d6b6e9db04d4babeec293c73b9e399904daf483e32839a86b2032c9242208fb9cc517e43799bcaa98b248
6
+ metadata.gz: e7657e1bd1475b810902f98dfdb5706b06d42c265c725b978de734158552153c40cec1e4ded21a2ba6b97bf9e58dccf2dd0327b29414e3f4e02463c9d698e7e1
7
+ data.tar.gz: 2de51ed4b88d532034fe71e98812bc3fdca2fdc54fd95479519dd9a624925afddfe9cfaa4ab18159806d5f9120c13b9efa45ad9403cd446674cdd58046eb2fe1
@@ -1,3 +1,3 @@
1
1
  module Weighable
2
- VERSION = '0.4.0'.freeze
2
+ VERSION = '0.5.0'.freeze
3
3
  end
@@ -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.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-05 00:00:00.000000000 Z
11
+ date: 2016-04-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport