Module: LambdaAccessor::ClassMethods
- Defined in:
- lib/i18n_translation_spawner/lambda_accessor.rb
Instance Method Summary collapse
Instance Method Details
#lambda_accessor(*args) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/i18n_translation_spawner/lambda_accessor.rb', line 19 def lambda_accessor(*args) args.map(&:to_s).each do |name| attr_accessor "#{name}_handler" define_method(name){|*args| if (handler = self.send("#{name}_handler")).respond_to?(:call) handler.call(*[self, args].flatten) else self.send("default_#{name}_handler", *args) end } end end |