Class: Ciphr::Functions::Simple::Translate
- Inherits:
-
Function
- Object
- Function
- Ciphr::Functions::Simple::Translate
show all
- Defined in:
- lib/ciphr/functions/simple.rb
Instance Attribute Summary
Attributes inherited from Function
#args, #options
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Function
aligned, inherited, #initialize, invertable?, #prepend, #read
Class Method Details
.params ⇒ Object
73
74
75
|
# File 'lib/ciphr/functions/simple.rb', line 73
def self.params
[:input,:ch1,:ch2]
end
|
.variants ⇒ Object
69
70
71
|
# File 'lib/ciphr/functions/simple.rb', line 69
def self.variants
[ [['tr','translate'], {}] ]
end
|
Instance Method Details
#apply ⇒ Object
56
57
58
59
60
61
62
63
64
65
66
67
|
# File 'lib/ciphr/functions/simple.rb', line 56
def apply
input, ch1in, ch2in = @args
ch1, ch2 = [ch1in.read, ch2in.read]
Proc.new do
inchunk = input.read(1)
if inchunk
inchunk.tr(ch1, ch2)
else
nil
end
end
end
|