range_math 0.7.1 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +6 -14
- checksums.yaml.gz.sig +2 -1
- data.tar.gz.sig +0 -0
- data/lib/range_math.rb +24 -51
- data/range_math.gemspec +2 -3
- metadata +28 -35
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
metadata.gz: !binary |-
|
9
|
-
ODhhNzUxMjdiZDM1NDUzZjI3ZGZjODFjYjlkYWU1YWI3MjExYmYwNTkzZDI5
|
10
|
-
NTRkZmQ3Y2ZiMjBhZTRkNjg2Yzc2YjI3NmFiYTA2MjUzZDdjYWUxYzRhZTFm
|
11
|
-
NzRkMWFlZjMzZjQ2OGE4M2FmNmRjMTdlYjM0NjU5YmJjOTE4MjM=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
MjY1MWM2NGVhOWFiN2QxZDk2MmE4YzNiNzliOTZjYWI1MzIzMDNiY2RmODBi
|
14
|
-
ZjY3ZDlhOGRkZTg1MjlhN2UxYTg0OTYyOTczNTM2YjNmZDljYmE2Y2Q0OTU2
|
15
|
-
ZmYzNDhmMjI4ZjQyN2YwZjdmY2UwOTljNjNhNjQ3ODNkM2UzOGM=
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 620bf7ea57587d8d754dd1dc107ca4185ee7cd9d
|
4
|
+
data.tar.gz: 182a12eda6a39d2f3f9d6480a62e95a3998e1f83
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3805e56ed10b2f356d7ebf0448274398807c727313186fea17f03854d62460e10f98fbb28ff942faa629d519680bf425f585fe5cd15a202cfa65978edadf1147
|
7
|
+
data.tar.gz: 5d0cd87757f9ac826b62ed751052ef7ab8af6dbcb8312faa601389d9845a1227f71f1bed10d6b6eb1462a0ac5c8edb6c92439fd36525c29907b235050d3048f2
|
checksums.yaml.gz.sig
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
z
|
1
|
+
�$�3�L�z�^�L"����"z�D�o ^���=R�zQ�Ve�_@Q��%���pb��&-��5Ia�4Gx�@z[��օ��e����߈U��F����/ҽ{kE�C1�f��� ��P&�za�EU������G4'@�+J*�?O��o>dsO�`�iv��!
|
2
|
+
�!�\d���vՓ�\C"%�ڭ����<
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/range_math.rb
CHANGED
@@ -4,79 +4,52 @@
|
|
4
4
|
# License: GNU GPL 3 <http://www.gnu.org/copyleft/gpl.html>
|
5
5
|
|
6
6
|
class Range
|
7
|
-
def +(other)
|
8
|
-
|
9
|
-
end
|
10
|
-
|
11
|
-
def
|
12
|
-
|
13
|
-
end
|
14
|
-
|
15
|
-
def *(other)
|
16
|
-
pair_or_num :*, other
|
17
|
-
end
|
18
|
-
|
19
|
-
def /(other)
|
20
|
-
pair_or_num :/, other.to_f
|
21
|
-
end
|
22
|
-
|
23
|
-
def **(other)
|
24
|
-
pair_or_num :**, other
|
25
|
-
end
|
7
|
+
def +(other) ; pair_or_num :+, other ; end
|
8
|
+
def -(other) ; pair_or_num :-, other ; end
|
9
|
+
def *(other) ; pair_or_num :*, other ; end
|
10
|
+
def /(other) ; pair_or_num :/, other.to_f ; end
|
11
|
+
def **(other) ; pair_or_num :**, other ; end
|
12
|
+
def %(other) ; pair_or_num :%, other ; end
|
26
13
|
|
27
|
-
def
|
28
|
-
|
29
|
-
end
|
30
|
-
|
31
|
-
def to_f
|
32
|
-
(self.begin.to_f..self.end.to_f)
|
33
|
-
end
|
34
|
-
|
35
|
-
def to_i
|
36
|
-
(self.begin.round..self.end.round)
|
37
|
-
end
|
14
|
+
def to_f ; (self.begin.to_f..self.end.to_f) ; end
|
15
|
+
def to_i ; (self.begin.round..self.end.round) ; end
|
38
16
|
|
39
17
|
def round places=0
|
40
18
|
(self.begin.round(places)..self.end.round(places))
|
41
19
|
end
|
42
|
-
|
20
|
+
|
43
21
|
def average
|
44
22
|
(self.begin + self.end) / 2.0
|
45
23
|
end
|
46
24
|
|
47
25
|
def coerce(other)
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
return (other..other), self
|
26
|
+
case other
|
27
|
+
when Range ; return other, self
|
28
|
+
when Numeric ; return (other..other), self
|
52
29
|
else
|
53
30
|
super
|
54
31
|
end
|
55
32
|
end
|
56
33
|
|
57
34
|
private
|
58
|
-
|
35
|
+
|
59
36
|
def pair_or_num operator, other
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
calc_pairs operator, (other..other)
|
37
|
+
case other
|
38
|
+
when Range ; calc_pairs operator, other
|
39
|
+
when Numeric ; calc_pairs operator, (other..other)
|
64
40
|
else
|
65
41
|
raise NoMethodError
|
66
42
|
end
|
67
43
|
end
|
68
|
-
|
44
|
+
|
69
45
|
def calc_pairs operator, other
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
46
|
+
results = [
|
47
|
+
self.begin .send(operator, other.begin),
|
48
|
+
self.begin .send(operator, other.end),
|
49
|
+
self.end .send(operator, other.begin),
|
50
|
+
self.end .send(operator, other.end),
|
51
|
+
]
|
52
|
+
|
80
53
|
(results.min..results.max)
|
81
54
|
end
|
82
55
|
end
|
data/range_math.gemspec
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "range_math"
|
3
|
-
s.version = "0.
|
3
|
+
s.version = "0.8.0"
|
4
4
|
|
5
5
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
6
6
|
s.authors = ["muflax"]
|
7
7
|
s.description = "use ranges in math expression"
|
8
8
|
s.email = "mail@muflax.com"
|
9
|
-
s.license = "GPL-
|
9
|
+
s.license = "GPL-3"
|
10
10
|
s.extra_rdoc_files = [
|
11
11
|
"README"
|
12
12
|
]
|
@@ -15,4 +15,3 @@ Gem::Specification.new do |s|
|
|
15
15
|
s.require_paths = ["lib"]
|
16
16
|
s.summary = "do math on ranges"
|
17
17
|
end
|
18
|
-
|
metadata
CHANGED
@@ -1,41 +1,34 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: range_math
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- muflax
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain:
|
11
|
-
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
WnRpVnZtYUdEZ3NzVnR6UGdMWW1PR3ZrQ1dzRlFGa3c0eU5RaAo2a2YxRVRF
|
33
|
-
NHdMVHI2clpiTjdpa216NlhGblVlQjBNdkFKcVoyc1o3VGg3WTRHTURBcTJX
|
34
|
-
TTg2TTY1WHRrUmQyClRoejVYbWZLWmJYMzlJQnE0bWIvZzdwRlpoTklEQUY4
|
35
|
-
Y1MyUGlRZS91RjRXaEZxd3BMNURLbEtzYi9JY3hPNUIKL2RYeElGbVlVaWFv
|
36
|
-
RzYyOWlKVGdMaTFLcXFZSXFsVG5hRUZaeG1MSmZsZjNqL0Q4Z1NxeHVVSVBh
|
37
|
-
amk1cS93eAotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==
|
38
|
-
date: 2013-09-12 00:00:00.000000000 Z
|
11
|
+
- |
|
12
|
+
-----BEGIN CERTIFICATE-----
|
13
|
+
MIIDLDCCAhSgAwIBAgIBATANBgkqhkiG9w0BAQUFADA8MQ0wCwYDVQQDDARtYWls
|
14
|
+
MRYwFAYKCZImiZPyLGQBGRYGbXV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/+i0PzT69bN5W+96Yp2JUDPmQXTG2QGwWDqEQF/BnHtlVQ/1w649V+
|
30
|
+
-----END CERTIFICATE-----
|
31
|
+
date: 2014-11-26 00:00:00.000000000 Z
|
39
32
|
dependencies: []
|
40
33
|
description: use ranges in math expression
|
41
34
|
email: mail@muflax.com
|
@@ -44,8 +37,8 @@ extensions: []
|
|
44
37
|
extra_rdoc_files:
|
45
38
|
- README
|
46
39
|
files:
|
47
|
-
- .document
|
48
|
-
- .gitignore
|
40
|
+
- ".document"
|
41
|
+
- ".gitignore"
|
49
42
|
- README
|
50
43
|
- Rakefile
|
51
44
|
- TODO
|
@@ -55,7 +48,7 @@ files:
|
|
55
48
|
- test/test_range_math.rb
|
56
49
|
homepage: http://github.com/muflax/range_math
|
57
50
|
licenses:
|
58
|
-
- GPL-
|
51
|
+
- GPL-3
|
59
52
|
metadata: {}
|
60
53
|
post_install_message:
|
61
54
|
rdoc_options: []
|
@@ -63,17 +56,17 @@ require_paths:
|
|
63
56
|
- lib
|
64
57
|
required_ruby_version: !ruby/object:Gem::Requirement
|
65
58
|
requirements:
|
66
|
-
- -
|
59
|
+
- - ">="
|
67
60
|
- !ruby/object:Gem::Version
|
68
61
|
version: '0'
|
69
62
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
70
63
|
requirements:
|
71
|
-
- -
|
64
|
+
- - ">="
|
72
65
|
- !ruby/object:Gem::Version
|
73
66
|
version: '0'
|
74
67
|
requirements: []
|
75
68
|
rubyforge_project:
|
76
|
-
rubygems_version: 2.
|
69
|
+
rubygems_version: 2.4.1
|
77
70
|
signing_key:
|
78
71
|
specification_version: 4
|
79
72
|
summary: do math on ranges
|
metadata.gz.sig
CHANGED
Binary file
|