lib/junoser/display/structure.rb in junoser-0.1.2 vs lib/junoser/display/structure.rb in junoser-0.1.3
- old
+ new
@@ -1,29 +1,28 @@
+require 'junoser/input'
require 'junoser/display/config_store'
require 'junoser/parser'
require 'junoser/transformer'
module Junoser
module Display
class Structure
- include Base
-
def initialize(io_or_string)
- super
+ @input = io_or_string
@config = Junoser::Display::ConfigStore.new
end
def transform
parser = Junoser::Parser.new
transform = Junoser::Transformer.new
- read_io_or_string.split("\n").each do |line|
+ Junoser::Input.new(@input).read.split("\n").each do |line|
transformed = transform.apply(parser.parse(line))
raise "ERROR: parse failed" unless transformed.is_a?(String)
@config << transformed
end
- @output.puts @config.to_s
+ @config.to_s
end
end
end
end