module Bgem

Constants

CONFIG_FILE
INDENT
SOURCE_FILE

Public Class Methods

new(file = SOURCE_FILE, indent: 0) click to toggle source
# 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
run(config_file = CONFIG_FILE) click to toggle source
# File lib/bgem.rb, line 10
def run config_file = CONFIG_FILE
  config = Config.new config_file
  write = Write.new config
  write[Output.new(config.entry).to_s]
  write
end

Public Instance Methods

to_s() click to toggle source
# File lib/bgem.rb, line 157
def to_s
  @output.to_s.indent @indent
end