class Bumbleworks::Api::Presenter

Attributes

presented[R]

Public Class Methods

from_array(array) click to toggle source
# File lib/bumbleworks/api/lib/presenter.rb, line 15
def from_array(array)
  array.map { |presented|
    new(presented, in_collection: true)
  }
end
new(presented, in_collection: false) click to toggle source
# File lib/bumbleworks/api/lib/presenter.rb, line 22
def initialize(presented, in_collection: false)
  @presented = presented
  @in_collection = in_collection
end
present(presented) click to toggle source
# File lib/bumbleworks/api/lib/presenter.rb, line 7
def present(presented)
  if presented.is_a?(Array)
    from_array(presented)
  else
    new(presented)
  end
end

Public Instance Methods

in_collection?() click to toggle source
# File lib/bumbleworks/api/lib/presenter.rb, line 27
def in_collection?
  @in_collection == true
end