class Xembly::Base
Code base abstraction
Public Class Methods
new(opts)
click to toggle source
Ctor.
opts
-
Options
# File lib/xembly.rb, line 56 def initialize(opts) @opts = opts Xembly.log.level = Logger::INFO if @opts.verbose? Xembly.log.info "my version is #{Xembly::VERSION}" Xembly.log.info "Ruby version is #{RUBY_VERSION} at #{RUBY_PLATFORM}" end
Public Instance Methods
xml()
click to toggle source
Generate XML.
# File lib/xembly.rb, line 64 def xml if @opts.xml? xml = File.read(@opts[:xml]) Xembly.log.info "reading #{@opts[:xml]}" else xml = $stdin.read Xembly.log.info 'reading STDIN' end if @opts.dirs? Xembly.log.info "reading directives from #{@opts[:dirs]}" dirs = File.read(@opts[:dirs]) else Xembly.log.info "#{@opts.arguments.length} directives in command line" dirs = @opts.arguments.join end Xembler.new(Directives.new(dirs)).apply(xml).to_xml end