class OroGen::Loaders::Project
Class that allows to load an oroGen file to build a {Spec::Project}
It basically ignores any statements that are not part of the spec, assuming that they are part of the code-generation side of things
Public Class Methods
const_missing(m)
click to toggle source
# File lib/orogen/loaders/project.rb, line 126 def self.const_missing(m) ::Kernel.const_get(m) end
new(spec)
click to toggle source
@param [Spec::Project] spec the project model we are building
# File lib/orogen/loaders/project.rb, line 91 def initialize(spec) @spec = spec end
Public Instance Methods
__eval__(deffile, deftext, verbose = (::OroGen.logger.level == ::Logger::DEBUG))
click to toggle source
# File lib/orogen/loaders/project.rb, line 144 def __eval__(deffile, deftext, verbose = (::OroGen.logger.level == ::Logger::DEBUG)) if !deffile @load_doc = false instance_eval deftext else @load_doc = ::File.file?(deffile) instance_eval deftext, deffile, 1 end self rescue ::Exception => e if true || verbose then ::Kernel.raise else this_level = ::Kernel.caller.size until_here = e.backtrace[-(this_level-1)..-1] || [] subcalls = e.backtrace[0, e.backtrace.size - this_level - 1] || [] subcalls.delete_if { |line| line =~ /eval|method_missing/ && line !~ /\.orogen/ } subcalls = subcalls.map { |line| line.gsub(/:in `(?:block in )?__eval__'/, '') } ::Kernel.raise e, e.message, (subcalls + until_here) end end
__load__(file, verbose = (::OroGen.logger.level == ::Logger::DEBUG))
click to toggle source
# File lib/orogen/loaders/project.rb, line 139 def __load__(file, verbose = (::OroGen.logger.level == ::Logger::DEBUG)) deffile = ::File.expand_path(file) __eval__(deffile, File.read(deffile), verbose) end
find_task_context(name)
click to toggle source
# File lib/orogen/loaders/project.rb, line 130 def find_task_context(name) @spec.loader.task_model_from_name(name) rescue OroGen::TaskModelNotFound end
has_typekit?(name)
click to toggle source
# File lib/orogen/loaders/project.rb, line 135 def has_typekit?(name) @spec.loader.has_typekit?(name) end
import_types_from(typekit)
click to toggle source
Calls superclass method
# File lib/orogen/loaders/project.rb, line 100 def import_types_from(typekit) # Filter out the files ... For now, by ignoring stuff that is # not a typekit if typekit.respond_to?(:to_str) && !@spec.loader.has_typekit?(typekit) return end super end
method_missing(m, *args, &block)
click to toggle source
# File lib/orogen/loaders/project.rb, line 120 def method_missing(m, *args, &block) if @spec.respond_to?(m) @spec.send(m, *args, &block) end end
task_context(*args, &block)
click to toggle source
Calls superclass method
# File lib/orogen/loaders/project.rb, line 109 def task_context(*args, &block) load_doc = @load_doc model = super(*args) do ::OroGen::Loaders::TaskContext.new(load_doc, self).instance_eval(&block) end if @load_doc Spec.load_documentation(model, /^task_context/) end model end
typekit()
click to toggle source
# File lib/orogen/loaders/project.rb, line 165 def typekit BlackHole.new end
using_typekit(typekit)
click to toggle source
For backward-compatibility reasons
# File lib/orogen/loaders/project.rb, line 96 def using_typekit(typekit) import_types_from(typekit) end