Class: Junoser::Display::Structure
- Inherits:
-
Object
- Object
- Junoser::Display::Structure
- Includes:
- Base
- Defined in:
- lib/junoser/display/structure.rb
Instance Attribute Summary
Attributes included from Base
Instance Method Summary collapse
-
#initialize(io_or_string) ⇒ Structure
constructor
A new instance of Structure.
- #transform ⇒ Object
Constructor Details
#initialize(io_or_string) ⇒ Structure
Returns a new instance of Structure.
10 11 12 13 |
# File 'lib/junoser/display/structure.rb', line 10 def initialize(io_or_string) super @config = Junoser::Display::ConfigStore.new end |
Instance Method Details
#transform ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/junoser/display/structure.rb', line 15 def transform parser = Junoser::Parser.new transform = Junoser::Transformer.new read_io_or_string.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 end |