Module: Tramway::Helpers::DecorateHelper
- Included in:
- BaseDecorator
- Defined in:
- lib/tramway/helpers/decorate_helper.rb
Overview
Provides methods into Rails ActionController
Instance Method Summary collapse
-
#tramway_decorate(object_or_array, decorator: nil) ⇒ Object
:reek:NilCheck { enabled: false } because checking for nil is not a type-checking issue but business logic.
Instance Method Details
#tramway_decorate(object_or_array, decorator: nil) ⇒ Object
:reek:NilCheck { enabled: false } because checking for nil is not a type-checking issue but business logic
11 12 13 14 15 16 17 |
# File 'lib/tramway/helpers/decorate_helper.rb', line 11 def tramway_decorate(object_or_array, decorator: nil) return [] if Tramway::Decorators::CollectionDecorators.collection?(object_or_array) && object_or_array.empty? return if object_or_array.nil? Tramway::Decorators::ClassHelper.decorator_class(object_or_array, decorator).decorate object_or_array end |