class IDL::Backend

Attributes

name[R]
root[R]
title[R]

Public Class Methods

configure(be_name, root, title, copyright, version, &block) click to toggle source
# File lib/ridl/backend.rb, line 57
def self.configure(be_name, root, title, copyright, version, &block)
  cfg = Configurator.new(be_name, root, title, copyright, version)
  block.call(cfg)
  @@backends[cfg.backend.name] = cfg.backend
end
load(be_name) click to toggle source
# File lib/ridl/backend.rb, line 42
def self.load(be_name)
  begin
    # load mapping from standard extension dir in Ruby search path
    require "ridlbe/#{be_name}/require"
    IDL.log(1, "> loaded RIDL backend :#{be_name} from #{@@backends[be_name.to_sym].root}")
    # return backend
    return @@backends[be_name.to_sym]
  rescue LoadError => e
    IDL.error "ERROR: Cannot load RIDL backend [:#{be_name}]"
    IDL.error e.inspect
    IDL.error(e.backtrace.join("\n")) if IDL.verbose_level.positive?
    exit 1
  end
end
new(be_name, root, ttl, cpr, ver) click to toggle source
# File lib/ridl/backend.rb, line 68
def initialize(be_name, root, ttl, cpr, ver)
  @name = be_name.to_sym
  @root = root
  @title = ttl
  @copyright = cpr
  @version = (Hash === ver ? ver : { major: ver.to_i, minor: 0, release: 0 })
  @base_backends = []
end
null_be() click to toggle source
# File lib/ridl/backend.rb, line 110
def self.null_be
  @@null_be ||= self.configure('null', '.', 'RIDL Null backend', "Copyright (c) 2013-#{Time.now.year} Remedy IT Expertise BV, The Netherlands", 1) do |becfg|
    becfg.on_setup do |optlist, params|
      # noop
      IDL.log(0, "Setup called for #{becfg.backend.title}")
    end
  end
end
stop_processing(msg = '') click to toggle source

stop processing of current input and skip to next or exit RIDL

# File lib/ridl/backend.rb, line 64
def self.stop_processing(msg = '')
  raise ProcessStop, msg, caller(1).first
end

Public Instance Methods

lookup_path() click to toggle source
# File lib/ridl/backend.rb, line 90
def lookup_path
  @base_backends.inject([@root]) { |paths, bbe| paths.concat(bbe.lookup_path) }
end
print_version() click to toggle source
process_input(parser, params) click to toggle source
# File lib/ridl/backend.rb, line 102
def process_input(parser, params)
  # process input bottom-up
  @base_backends.reverse.each { |be| be.process_input(parser, params) }
  _process_input(parser, params) if self.respond_to?(:_process_input, true)
end
setup_be(optlist, idl_options) click to toggle source
# File lib/ridl/backend.rb, line 94
def setup_be(optlist, idl_options)
  # initialize base backends in reverse order so each dependent BE can overrule its
  # base settings
  @base_backends.reverse.each { |be| be.setup_be(optlist, idl_options) }
  # initialize this backend
  _setup_be(optlist, idl_options) if self.respond_to?(:_setup_be, true)
end
version() click to toggle source
# File lib/ridl/backend.rb, line 79
def version
  "#{@version[:major]}.#{@version[:minor]}.#{@version[:release]}"
end