Module: SimpleDecorator::RailsHelpers

Includes:
ActionView::Helpers::NumberHelper, ActionView::Helpers::TranslationHelper
Included in:
Base
Defined in:
lib/simple_decorator/rails_helpers.rb

Instance Method Summary collapse

Instance Method Details

#try(*args, &block) ⇒ Object

Rails try is delegated to component instead calling it on delegator itself. github.com/rails/rails/commit/2575508a385f4a8003ea1277025c018583971e1d



8
9
10
11
12
13
14
# File 'lib/simple_decorator/rails_helpers.rb', line 8

def try(*args, &block)
  if args.empty? && block_given?
    yield self
  else
    public_send *args, &block if respond_to? args.first
  end
end