Module: Ciphr
- Defined in:
- lib/ciphr.rb,
lib/ciphr/stream.rb,
lib/ciphr/version.rb,
lib/ciphr/function_registry.rb
Defined Under Namespace
Modules: Functions
Classes: FunctionRegistry, Parser, Stream, Transformer
Constant Summary
collapse
- VERSION =
"0.0.6"
- @@init =
false
Class Method Summary
collapse
Class Method Details
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/ciphr.rb', line 14
def self.transform(spec, input = STDIN, output = STDOUT)
init if !@@init
if input.is_a? String
input = StringIO.new(input)
input.binmode
input.close_write
output = StringIO.new()
output.binmode
end
parsed = Ciphr::Parser.new.parse(spec)
transformed = Ciphr::Transformer.new(input).apply(parsed)
while chunk = transformed.read(256)
output.write chunk
end
if output.is_a? StringIO
output.string
else
nil
end
end
|