class Ciphr::Functions::Simple::Repack

Public Class Methods

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

Public Instance Methods

apply() click to toggle source
# File lib/ciphr/functions/simple.rb, line 30
def apply
  input, ch1in, ch2in = @args
  content, ch1, ch2 = [input.read, ch1in.read, ch2in.read]
  Proc.new do
    if content
      begin
        content.unpack(ch1).pack(ch2)
      ensure
        content = nil
      end
    else
      nil
    end
  end
end