lib/azeroth/decorator.rb in azeroth-0.6.1 vs lib/azeroth/decorator.rb in azeroth-0.6.2

- old
+ new

@@ -39,10 +39,11 @@ # # 'age' => nil, # # 'pokemon' => 'Arcanine' # # } class Decorator autoload :HashBuilder, 'azeroth/decorator/hash_builder' + autoload :Options, 'azeroth/decorator/options' class << self # @api private # # All attributes exposed @@ -99,10 +100,12 @@ # def name # [object.first_name, object.last_name].join(' ') # end # end # end - def expose(attribute, **options) + def expose(attribute, **options_hash) + options = Decorator::Options.new(options_hash) + builder = Sinclair.new(self) builder.add_method(attribute, "@object.#{attribute}") builder.build attributes_map[attribute] = options