lib/rgen/model_builder/builder_context.rb in rgen-0.5.4 vs lib/rgen/model_builder/builder_context.rb in rgen-0.6.0

- old
+ new

@@ -23,10 +23,26 @@ def const_missing_delegated(delegator, const) ConstPathElement.new(const, self) end + # in Ruby 1.9.0 and 1.9.1 #instance_eval looks up constants in the calling scope + # that's why const_missing needs to be prepared in BuilderContext, too + class << self + def currentBuilderContext=(bc) + @@currentBuilderContext = bc + end + + def const_missing(name) + if @@currentBuilderContext + ConstPathElement.new(name, @@currentBuilderContext) + else + super + end + end + end + class CommandResolver def initialize(rootPackage, extensionsModule, builderContext) @extensionFactory = ExtensionContainerFactory.new(rootPackage, extensionsModule, builderContext) @packageResolver = PackageResolver.new(rootPackage, @extensionFactory) @resolveCommand = {} @@ -313,6 +329,6 @@ end end -end \ No newline at end of file +end