asker-tool 2.9.0 → 2.9.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/asker/ai/problem/customizer.rb +57 -3
- data/lib/asker/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: cf109d783e6f90f7a4d5fdf9096a5be939e63e294d41532d84506b77b83ef3a9
|
4
|
+
data.tar.gz: 6e08aec493068877d96f9e1f264638ea798bff3a26d6c665802b22b79ff1ce07
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '09b3aeb201e0fefc3b66a2e50dc4d7b92cdabe4a641db412b556cf85b55d97a36d5f416fe06eeb8d5df72d7a72368f12a7571d062b0181ee14851cd05f96079e'
|
7
|
+
data.tar.gz: e6278f54603305c6fae82d814eb646c9ed4c403196413869b40b38da582abe50704b41a80dfbda1218ee2a27780e1dc70c8eb967ad36c884b9e723e8893c5de4
|
@@ -8,9 +8,9 @@ class Customizer
|
|
8
8
|
def call(text:, custom:, type: nil)
|
9
9
|
output = text.clone
|
10
10
|
custom.each_pair { |oldvalue, newvalue| output.gsub!(oldvalue, newvalue) }
|
11
|
-
|
11
|
+
|
12
12
|
if type.nil?
|
13
|
-
return output
|
13
|
+
return output
|
14
14
|
elsif type == "formula"
|
15
15
|
begin
|
16
16
|
return eval(output).to_s
|
@@ -33,4 +33,58 @@ class Customizer
|
|
33
33
|
def max(*args)
|
34
34
|
args.max
|
35
35
|
end
|
36
|
-
|
36
|
+
|
37
|
+
def bin2dec(value)
|
38
|
+
value.to_s.to_i(2).to_s
|
39
|
+
end
|
40
|
+
|
41
|
+
def bin2hex(value)
|
42
|
+
dec = bin2dec(value)
|
43
|
+
dec2hex(dec)
|
44
|
+
end
|
45
|
+
|
46
|
+
def bin2oct(value)
|
47
|
+
dec = bin2dec(value)
|
48
|
+
dec2oct(dec)
|
49
|
+
end
|
50
|
+
|
51
|
+
def dec2bin(value)
|
52
|
+
value.to_i.to_s(2)
|
53
|
+
end
|
54
|
+
|
55
|
+
def dec2hex(value)
|
56
|
+
value.to_i.to_s(16)
|
57
|
+
end
|
58
|
+
|
59
|
+
def dec2oct(value)
|
60
|
+
value.to_i.to_s(8).to_s
|
61
|
+
end
|
62
|
+
|
63
|
+
def hex2bin(value)
|
64
|
+
dec = hex2dec(value)
|
65
|
+
dec2bin(dec)
|
66
|
+
end
|
67
|
+
|
68
|
+
def hex2dec(value)
|
69
|
+
value.to_s.to_i(16).to_s
|
70
|
+
end
|
71
|
+
|
72
|
+
def hex2oct(value)
|
73
|
+
dec = hex2dec(value)
|
74
|
+
dec2oct(dec)
|
75
|
+
end
|
76
|
+
|
77
|
+
def oct2bin(value)
|
78
|
+
dec = oct2dec(value)
|
79
|
+
dec2bin(dec)
|
80
|
+
end
|
81
|
+
|
82
|
+
def oct2dec(value)
|
83
|
+
value.to_s.to_i(8).to_s
|
84
|
+
end
|
85
|
+
|
86
|
+
def oct2hex(value)
|
87
|
+
dec = oct2dec(value)
|
88
|
+
dec2hex(dec)
|
89
|
+
end
|
90
|
+
end
|
data/lib/asker/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: asker-tool
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.9.
|
4
|
+
version: 2.9.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Vargas Ruiz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-10-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: haml
|