class Presento::Base

Public Class Methods

present(object) { |self| ... } click to toggle source

present the given object and optionally yield it

# File lib/presento/base.rb, line 22
def present object
  if block_given?
    yield(self.new(object))
  else
    self.new(object)
  end
end
present_each(collection)
Alias for: wrap_all
wrap_all(collection) { |presenter| ... } click to toggle source
# File lib/presento/base.rb, line 13
def wrap_all collection
  collection.each do |object|
    presenter = self.new(object)
    yield(presenter)
  end
end
Also aliased as: present_each

Public Instance Methods

class() click to toggle source
# File lib/presento/base.rb, line 4
def class
  model.class
end
to_model() click to toggle source
# File lib/presento/base.rb, line 8
def to_model
  model
end

Protected Instance Methods

model() click to toggle source
# File lib/presento/base.rb, line 32
def model
  __getobj__
end