analog 0.4.1 → 0.4.2
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/LICENSE +1 -1
- data/README.md +4 -3
- data/lib/scale.rb +5 -2
- data/lib/scale/scheme.rb +17 -10
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0ca5b95340638a16df7216da31a80145520cd467
|
4
|
+
data.tar.gz: 1b4b248f6a9db4459d489385d43b53ef3b181c59
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0de8ad8f42594367f7427fcf95b64fb90ca2fef9801c5e2a28f9c32495574a44cae80de43c76ddf63fdce7ef9ea692fed236586470be7e236f573709fe0da24b
|
7
|
+
data.tar.gz: 1f26e81c89f06055d45bcaffbfd226ccab9417a6db6afd7b85b18ca40538b0cb62e61e0275980dadd1dece484524f998b9851cc63a7e94c269fb0b8dab438168
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
#
|
1
|
+
# Analog
|
2
2
|
|
3
|
-
A Ruby helper for scaling numbers
|
3
|
+
A Ruby helper for scaling numbers
|
4
4
|
|
5
5
|
#### Background
|
6
6
|
|
@@ -77,4 +77,5 @@ or with Bundler
|
|
77
77
|
#### License
|
78
78
|
|
79
79
|
Licensed under Apache 2.0, See the file LICENSE
|
80
|
-
|
80
|
+
|
81
|
+
Copyright (c) 2014-2017 [Ari Russo](http://arirusso.com)
|
data/lib/scale.rb
CHANGED
@@ -1,8 +1,11 @@
|
|
1
1
|
# Analog
|
2
2
|
# Helper for scaling numbers
|
3
|
-
#
|
3
|
+
# https://github.com/arirusso/analog
|
4
|
+
#
|
5
|
+
# (c) 2014-2017 Ari Russo
|
4
6
|
# Licensed under Apache 2.0
|
5
7
|
#
|
8
|
+
|
6
9
|
require "scale/destination"
|
7
10
|
require "scale/scheme"
|
8
11
|
require "scale/source"
|
@@ -10,6 +13,6 @@ require "scale/source"
|
|
10
13
|
# Helper for scaling numbers
|
11
14
|
module Scale
|
12
15
|
|
13
|
-
VERSION = "0.4.
|
16
|
+
VERSION = "0.4.2"
|
14
17
|
|
15
18
|
end
|
data/lib/scale/scheme.rb
CHANGED
@@ -18,7 +18,7 @@ module Scale
|
|
18
18
|
end
|
19
19
|
|
20
20
|
# Build a scaling scheme starting with the given destination
|
21
|
-
# @param [::Enumerable] destination
|
21
|
+
# @param [::Enumerable] destination
|
22
22
|
# @return [Scale::Scheme]
|
23
23
|
def to(destination)
|
24
24
|
Scheme.new.to(destination)
|
@@ -42,8 +42,15 @@ module Scale
|
|
42
42
|
# @option options [::Enumerable] :source The source for this scaling scenario
|
43
43
|
def initialize(options = {})
|
44
44
|
@input = options[:input]
|
45
|
-
@
|
46
|
-
@
|
45
|
+
@destination = nil
|
46
|
+
@source = nil
|
47
|
+
|
48
|
+
unless options[:source].nil?
|
49
|
+
@source = Source.new(options[:source])
|
50
|
+
end
|
51
|
+
unless options[:destination].nil?
|
52
|
+
@destination = Destination.new(options[:destination])
|
53
|
+
end
|
47
54
|
end
|
48
55
|
|
49
56
|
# Set the source for this scaling scenario. If on calling this method, the scenario
|
@@ -57,8 +64,8 @@ module Scale
|
|
57
64
|
scale? ? result : self
|
58
65
|
end
|
59
66
|
|
60
|
-
# Set the destination for this scaling scenario. If on calling this method, the
|
61
|
-
# scenario has all of its needed properties, the scaled value will be returned.
|
67
|
+
# Set the destination for this scaling scenario. If on calling this method, the
|
68
|
+
# scenario has all of its needed properties, the scaled value will be returned.
|
62
69
|
# Otherwise this method will return the updated Scheme object.
|
63
70
|
#
|
64
71
|
# @param [::Enumerable] destination
|
@@ -68,8 +75,8 @@ module Scale
|
|
68
75
|
scale? ? result : self
|
69
76
|
end
|
70
77
|
|
71
|
-
# Set both the source and destination on this scheme. If on calling this method, the
|
72
|
-
# scenario has all of its needed properties, the scaled value will be returned.
|
78
|
+
# Set both the source and destination on this scheme. If on calling this method, the
|
79
|
+
# scenario has all of its needed properties, the scaled value will be returned.
|
73
80
|
# Otherwise this method will return the updated Scheme object.
|
74
81
|
#
|
75
82
|
# @param [::Enumerable] source
|
@@ -82,10 +89,10 @@ module Scale
|
|
82
89
|
end
|
83
90
|
|
84
91
|
|
85
|
-
# Set the input of this scaling scenario. If on calling this method, the
|
86
|
-
# scenario has all of its needed properties, the scaled value will be returned.
|
92
|
+
# Set the input of this scaling scenario. If on calling this method, the
|
93
|
+
# scenario has all of its needed properties, the scaled value will be returned.
|
87
94
|
# Otherwise this method will return the updated Scheme object.
|
88
|
-
#
|
95
|
+
#
|
89
96
|
# @param [Numeric] number
|
90
97
|
# @return [Numeric, Scale::Scheme]
|
91
98
|
def scale(number)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: analog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ari Russo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-05-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -112,7 +112,7 @@ files:
|
|
112
112
|
- test/source_test.rb
|
113
113
|
homepage: http://github.com/arirusso/analog
|
114
114
|
licenses:
|
115
|
-
- Apache
|
115
|
+
- Apache-2.0
|
116
116
|
metadata: {}
|
117
117
|
post_install_message:
|
118
118
|
rdoc_options: []
|
@@ -130,7 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
130
130
|
version: 1.3.6
|
131
131
|
requirements: []
|
132
132
|
rubyforge_project: analog
|
133
|
-
rubygems_version: 2.
|
133
|
+
rubygems_version: 2.6.8
|
134
134
|
signing_key:
|
135
135
|
specification_version: 4
|
136
136
|
summary: Helper for scaling numbers
|