lib/azeroth/decorator.rb in azeroth-0.7.4 vs lib/azeroth/decorator.rb in azeroth-0.8.0
- old
+ new
@@ -40,10 +40,11 @@
# # 'pokemon' => 'Arcanine'
# # }
class Decorator
autoload :HashBuilder, 'azeroth/decorator/hash_builder'
autoload :KeyValueExtractor, 'azeroth/decorator/key_value_extractor'
+ autoload :MethodBuilder, 'azeroth/decorator/method_builder'
autoload :Options, 'azeroth/decorator/options'
class << self
# @api private
#
@@ -226,12 +227,10 @@
# # }]
# # }
def expose(attribute, **options_hash)
options = Decorator::Options.new(options_hash)
- builder = Sinclair.new(self)
- builder.add_method(attribute, "@object.#{attribute}")
- builder.build
+ MethodBuilder.build_reader(self, attribute)
attributes_map[attribute] = options
end
end