Class: RGen::ModelBuilder::BuilderContext::PackageResolver
- Inherits:
-
Object
- Object
- RGen::ModelBuilder::BuilderContext::PackageResolver
- Defined in:
- lib/rgen/model_builder/builder_context.rb
Instance Method Summary collapse
-
#initialize(rootPackage, extensionFactory) ⇒ PackageResolver
constructor
A new instance of PackageResolver.
- #packageByCommand(contextPackage, name) ⇒ Object
Constructor Details
#initialize(rootPackage, extensionFactory) ⇒ PackageResolver
Returns a new instance of PackageResolver.
157 158 159 160 161 |
# File 'lib/rgen/model_builder/builder_context.rb', line 157 def initialize(rootPackage, extensionFactory) @rootPackage = rootPackage @extensionFactory = extensionFactory @packageByCommand = {} end |
Instance Method Details
#packageByCommand(contextPackage, name) ⇒ Object
163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 |
# File 'lib/rgen/model_builder/builder_context.rb', line 163 def packageByCommand(contextPackage, name) return @packageByCommand[[contextPackage, name]] if @packageByCommand.has_key?([contextPackage, name]) if @extensionFactory.extensionContainer(contextPackage).respond_to?(name) result = contextPackage else className = name.to_s[0..0].upcase + name.to_s[1..-1] eClass = contextPackage.eClasses.find{|c| c.name == className} if eClass result = contextPackage elsif contextPackage != @rootPackage result = packageByCommand(contextPackage.eSuperPackage, name) else result = nil end end @packageByCommand[[contextPackage, name]] = result end |