Class: Ciphr::Functions::Base::Base2
- 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
16
17
18
|
# File 'lib/ciphr/functions/base_radix.rb', line 16
def self.params
[:input]
end
|
.variants ⇒ Object
12
13
14
|
# File 'lib/ciphr/functions/base_radix.rb', line 12
def self.variants
[[['b2','base2', 'bin','binary'], {}]]
end
|
Instance Method Details
#apply ⇒ Object
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/ciphr/functions/base_radix.rb', line 20
def apply
input = @args[0]
if !invert
Proc.new do
chunk = input.read(1)
chunk && chunk.unpack("B*")[0]
end
else
Proc.new do
chunk = input.read(8)
chunk && [chunk].pack("B*")
end
end
end
|