Class: Ciphr::Functions::Base::Base32
- Inherits:
-
Base
show all
- Defined in:
- lib/ciphr/functions/base_radix.rb
Instance Attribute Summary
#invert
Attributes inherited from Function
#args, #options
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
aligned
invertable?
Methods inherited from Function
aligned, inherited, #initialize, invertable?, #prepend, #read
Class Method Details
.params ⇒ Object
99
100
101
|
# File 'lib/ciphr/functions/base_radix.rb', line 99
def self.params
[:input]
end
|
.variants ⇒ Object
90
91
92
93
94
95
96
97
|
# File 'lib/ciphr/functions/base_radix.rb', line 90
def self.variants
[
[['b32','base32','b32-std','base32-std'], {:object => ::Base32 }] ]
end
|
Instance Method Details
#apply ⇒ Object
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
# File 'lib/ciphr/functions/base_radix.rb', line 103
def apply
input = @args[0]
if !invert
Proc.new do
chunk = input.read(5)
chunk && options[:object].encode(chunk)
end
else
Proc.new do
chunk = input.read(8)
chunk && options[:object].decode(chunk)
end
end
end
|