lib/blueprints/dependency.rb in blueprints-0.8.1 vs lib/blueprints/dependency.rb in blueprints-0.8.2

- old
+ new

@@ -9,19 +9,21 @@ # # Blueprints::Dependency objects also catch all missing methods. They are later replayed on instance variable when getting value. Example: # d = Blueprints::Dependency.new(:blueprint).name.size # d.value # => 4 when @blueprint.name == 'John' class Blueprints::Dependency + instance_methods.each { |m| undef_method m if m =~ /^(to_|id$)/ } + # Initializes new copy of Blueprints::Dependency with name, iv_name and options. def initialize(name, *args) @name = name @options = args.extract_options! @iv_name = args.first || @name @registry = [] end # Builds blueprint (if necessary) and returns the value of instance variable. - def value + def blueprint_value Blueprints::RootNamespace.root.build @name => @options @registry.inject(Blueprints::RootNamespace.root.context.instance_variable_get(:"@#{@iv_name}")) do |value, (method, args, block)| value.send(method, *args, &block) end end