class Ciphr::Functions::Simple::Translate

Public Class Methods

params() click to toggle source
# File lib/ciphr/functions/simple.rb, line 73
def self.params
  [:input,:ch1,:ch2]
end
variants() click to toggle source
# File lib/ciphr/functions/simple.rb, line 69
def self.variants
  [ [['tr','translate'], {}] ]
end

Public Instance Methods

apply() click to toggle source
# 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