Class: RGen::ModelBuilder::BuilderContext::CommandResolver
- Inherits:
-
Object
- Object
- RGen::ModelBuilder::BuilderContext::CommandResolver
- Defined in:
- lib/rgen/model_builder/builder_context.rb
Instance Method Summary collapse
-
#initialize(rootPackage, extensionsModule, builderContext) ⇒ CommandResolver
constructor
A new instance of CommandResolver.
- #resolveCommand(cmd, parentPackage) ⇒ Object
Constructor Details
#initialize(rootPackage, extensionsModule, builderContext) ⇒ CommandResolver
Returns a new instance of CommandResolver.
45 46 47 48 49 |
# File 'lib/rgen/model_builder/builder_context.rb', line 45 def initialize(rootPackage, extensionsModule, builderContext) @extensionFactory = ExtensionContainerFactory.new(rootPackage, extensionsModule, builderContext) @packageResolver = PackageResolver.new(rootPackage, @extensionFactory) @resolveCommand = {} end |
Instance Method Details
#resolveCommand(cmd, parentPackage) ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/rgen/model_builder/builder_context.rb', line 51 def resolveCommand(cmd, parentPackage) return @resolveCommand[[parentPackage, cmd]] if @resolveCommand.has_key?([parentPackage, cmd]) package = @packageResolver.packageByCommand(parentPackage, cmd) result = nil if package extensionContainer = @extensionFactory.extensionContainer(package) if extensionContainer.respond_to?(cmd) result = extensionContainer else className = cmd.to_s[0..0].upcase + cmd.to_s[1..-1] result = package.eClasses.find{|c| c.name == className} end end @resolveCommand[[parentPackage, cmd]] = [package, result] end |