Class: ThemePresentation
- Inherits:
-
Object
- Object
- ThemePresentation
- Defined in:
- app/presenters/theme_presentation.rb
Class Method Summary collapse
Class Method Details
.wrap(data, *presenters) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'app/presenters/theme_presentation.rb', line 4 def self.wrap(data, *presenters) normalized = normalize(data) presenters = normalize_presenters(presenters) wrapped_data = presenters.inject(normalized) do |wrapped, presenter| presenter.new(wrapped) end class << wrapped_data attr_accessor :wrapped_by end wrapped_data.wrapped_by = presenters wrapped_data end |
.wrap_collection(collection, *presenters) ⇒ Object
21 22 23 |
# File 'app/presenters/theme_presentation.rb', line 21 def self.wrap_collection(collection, *presenters) collection.collect { |item| wrap(item, *presenters) } end |