Class: Bgem::Output
- Inherits:
-
Object
- Object
- Bgem::Output
- Defined in:
- lib/bgem.rb
Defined Under Namespace
Classes: Ext
Instance Method Summary collapse
-
#initialize(file = SOURCE_FILE, indent: 0) ⇒ Output
constructor
A new instance of Output.
- #to_s ⇒ Object
Constructor Details
#initialize(file = SOURCE_FILE, indent: 0) ⇒ Output
Returns a new instance of Output.
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 |
# File 'lib/bgem.rb', line 140 def initialize file = SOURCE_FILE, indent: 0 file, @indent = (Pathname file), indent *chain, last = file.basename.to_s.split '.' name = last.upcase source = file.read dir = file.dirname if Ext.const_defined? name ext = Ext.const_get name else fail "Don't know what to do with #{file}. Bgem::Output::Ext::#{name} is not defined." end @output = ext.new dir: dir, source: source, chain: chain end |
Instance Method Details
#to_s ⇒ Object
157 158 159 |
# File 'lib/bgem.rb', line 157 def to_s @output.to_s.indent @indent end |