fractify 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/fractify/calculator.rb +5 -3
- data/lib/fractify/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 256342505d06cb2fd2338b344fae8ad0ba418126440aff20a1833229747dc132
|
4
|
+
data.tar.gz: 528ac11d61c7a3837a435e0ea8aac3f7680db5dce1f41c8d1961f56c9e9d063e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 504ea1231303a40b44cc3970c06d82086be7028d7fa8af6eb8abd9527c274db6354bf771dadc8c44efab714beb242f50bb9cf45545ecdd3f808a738ef9d3f652
|
7
|
+
data.tar.gz: 75d89ad474977be8203e69658a15b8ad256998a13ca1b9401d55820c9b70337d2948fff471e67cb4db468fb1bf4e77e76121e3341123a50c1730bca8e82fe47a
|
data/Gemfile.lock
CHANGED
data/lib/fractify/calculator.rb
CHANGED
@@ -108,6 +108,8 @@ module Fractify
|
|
108
108
|
fraction = op.to_left * op.to_right
|
109
109
|
when '/'
|
110
110
|
fraction = op.to_left / op.to_right
|
111
|
+
when ':'
|
112
|
+
fraction = op.to_left / op.to_right
|
111
113
|
when '^'
|
112
114
|
fraction = op.to_left**op.to_right
|
113
115
|
end
|
@@ -135,9 +137,7 @@ module Fractify
|
|
135
137
|
operator_awaiting_an_argument,
|
136
138
|
last_char_is_a_closed_bracket = false
|
137
139
|
at_least_one_fraction = false
|
138
|
-
fraction = nil
|
139
140
|
|
140
|
-
operators = Fractify::OperatorArray.new
|
141
141
|
index = 0
|
142
142
|
|
143
143
|
formula.each_char do |char|
|
@@ -224,6 +224,8 @@ module Fractify
|
|
224
224
|
current_rank + 1
|
225
225
|
when '/'
|
226
226
|
current_rank + 1
|
227
|
+
when ':'
|
228
|
+
current_rank + 1
|
227
229
|
when '^'
|
228
230
|
current_rank + 2
|
229
231
|
else
|
@@ -232,7 +234,7 @@ module Fractify
|
|
232
234
|
end
|
233
235
|
|
234
236
|
def char_is_an_operator(char)
|
235
|
-
%w[+ - * / ^].include? char
|
237
|
+
%w[+ - * / : ^].include? char
|
236
238
|
end
|
237
239
|
|
238
240
|
def find_operator_with_left(operators, fraction)
|
data/lib/fractify/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fractify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mateusz Drewniak
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-03-
|
11
|
+
date: 2020-03-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|