class Object

Public Instance Methods

as_json(*args) click to toggle source
# File lib/slices/will_paginate.rb, line 2
def as_json(*args)
  {
    current_page: current_page,
    per_page: per_page,
    total_entries: total_entries,
    total_pages: total_pages,
    items: to_a
  }
end
main_extra_templates() click to toggle source
Calls superclass method
# File lib/generators/slice/templates/presenter.rb, line 21
def main_extra_templates
  super + ['<%= file_name %>/<%= page_name %>_main']
end
meta_extra_templates() click to toggle source
Calls superclass method
# File lib/generators/slice/templates/presenter.rb, line 25
def meta_extra_templates
  super + ['<%= file_name %>/<%= page_name %>_meta']
end
name() click to toggle source

The CMS needs to know how to present the data stored on a page; it's not always good enough just to convert it to a string and render it into the page. You can access the page through the @source variable.

# File lib/generators/slice/templates/presenter.rb, line 47
def name
  @source.name.blank? ? "(name isn't set)" : @source.name
end