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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cb6924c54cad0b4b8a04231d21f5b4e5e419f2150f6457b080eaa56ec45fc5bb
4
- data.tar.gz: d6fac1e84e3e4c7f1e836acac9a050fd36b300960e122e993f4af676905b8aaa
3
+ metadata.gz: cf109d783e6f90f7a4d5fdf9096a5be939e63e294d41532d84506b77b83ef3a9
4
+ data.tar.gz: 6e08aec493068877d96f9e1f264638ea798bff3a26d6c665802b22b79ff1ce07
5
5
  SHA512:
6
- metadata.gz: ee6ac3134f616e98e63f3ad2160325defc99b80e15082c62e8da378e401e3768bb6f75696e96d79f9e48ce1f652b0eeef8767796b8f61d53d717c1eaa405bebc
7
- data.tar.gz: 766d487ea2ca668819b6dd0c27459843d20be17ec4c1c54f7f114024b68b12c95e63f8aeff9c81b8016efbbd70cc74a32fb513549ad6c10255e1e9d36be4200c
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
- end
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
@@ -1,5 +1,5 @@
1
1
  class Asker
2
- VERSION = "2.9.0"
2
+ VERSION = "2.9.2"
3
3
  NAME = "asker"
4
4
  GEM = "asker-tool"
5
5
  CONFIGFILE = "asker.ini"
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.0
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-09-30 00:00:00.000000000 Z
11
+ date: 2023-10-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: haml