power_converter 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/power_converter.rb +9 -4
- data/lib/power_converter/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d0c79c8bb2c5a433c5e9be7f0d89b38d4f45dddb
|
4
|
+
data.tar.gz: 98a0b0f03b6f2418321c8cc8f8729792c65c9c5e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5be777d8d8d8f932306e80756e0e3b3d6dcbe1345c7b67028e23d4613be8ee00970af60cc0e751282520a7c58ba70802df6ae8825cfef5a0f12596fbaf1de65d
|
7
|
+
data.tar.gz: 0d611dbdab872ebefb5fa49ec3501132464a8c67a61e392fb119cbad6214270edcf48e76d2428fd8eccbacf2141c2fa990a5ef8f63a4645abe60b490c0a99eb8
|
data/lib/power_converter.rb
CHANGED
@@ -35,7 +35,9 @@ module PowerConverter
|
|
35
35
|
# great exception to raise.
|
36
36
|
class ConversionError < RuntimeError
|
37
37
|
# @param value [Object]
|
38
|
-
# @param
|
38
|
+
# @param options [Hash]
|
39
|
+
# @option options [Symbol] :to what did we just attempt to convert?
|
40
|
+
# @option options [Symbol] :scope is there a scope related to this conversion attempt?
|
39
41
|
#
|
40
42
|
# Do or do not. There is no try.
|
41
43
|
#
|
@@ -44,7 +46,7 @@ module PowerConverter
|
|
44
46
|
def initialize(value, options)
|
45
47
|
named_converter = options[:to]
|
46
48
|
scope = options[:scope]
|
47
|
-
super("Unable to convert #{value.inspect} to '#{named_converter}' (scope: #{scope.inspect}.")
|
49
|
+
super("Unable to convert #{value.inspect} to '#{named_converter}' (scope: #{scope.inspect}).")
|
48
50
|
end
|
49
51
|
end
|
50
52
|
|
@@ -56,8 +58,8 @@ module PowerConverter
|
|
56
58
|
# Responsible for defining a conversion method and a "shovel-ready" conversion
|
57
59
|
# module; because maybe you want a mixin for convenience reasons.
|
58
60
|
#
|
59
|
-
# @note If your defined converter returns `nil`, it is assumed
|
60
|
-
# conversion failed and a [PowerConverter::ConversionError] exception
|
61
|
+
# @note If your defined converter returns `nil`, it is assumed that the
|
62
|
+
# conversion failed and a [PowerConverter::ConversionError] exception will
|
61
63
|
# be thrown.
|
62
64
|
#
|
63
65
|
# @param named_conversion [String,Symbol] the name of the conversion that you
|
@@ -181,6 +183,9 @@ module PowerConverter
|
|
181
183
|
# end
|
182
184
|
#
|
183
185
|
# @todo Allow for the inclusion of multiple power converter named types.
|
186
|
+
#
|
187
|
+
# @note This does not allow for the robustness of the .convert method. I'm
|
188
|
+
# wondering about its ongoing value.
|
184
189
|
def module_for(named_conversion)
|
185
190
|
Module.new do
|
186
191
|
# HACK: I'd prefer to not lean on calling the underlying convert method
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: power_converter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Friesen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-07-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -126,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
126
126
|
version: '0'
|
127
127
|
requirements: []
|
128
128
|
rubyforge_project:
|
129
|
-
rubygems_version: 2.4.
|
129
|
+
rubygems_version: 2.4.7
|
130
130
|
signing_key:
|
131
131
|
specification_version: 4
|
132
132
|
summary: A lightweight library to define object conversion methods/modules.
|