class DiningTable::Presenters::Presenter

Attributes

options[RW]
table[RW]
view_context[RW]

Public Class Methods

new( options = {} ) click to toggle source
# File lib/dining-table/presenters/presenter.rb, line 9
def initialize( options = {} )
  self.options = default_options.merge( options )
end

Public Instance Methods

connect_to( table ) click to toggle source
# File lib/dining-table/presenters/presenter.rb, line 13
def connect_to( table )
  self.table = table
end
identifier() click to toggle source
# File lib/dining-table/presenters/presenter.rb, line 17
def identifier
  raise NotImplementedError
end
type?( identifier_ ) click to toggle source
# File lib/dining-table/presenters/presenter.rb, line 21
def type?( identifier_ )
  identifier == identifier_
end

Private Instance Methods

blank?( string ) click to toggle source

implementation adapted from ActiveSupport

# File lib/dining-table/presenters/presenter.rb, line 48
def blank?( string )
  string.respond_to?(:empty?) ? !!string.empty? : !string
end
columns() click to toggle source
# File lib/dining-table/presenters/presenter.rb, line 34
def columns
  table.columns
end
default_options() click to toggle source
# File lib/dining-table/presenters/presenter.rb, line 38
def default_options
  presenter = "#{ identifier }_presenter"
  if DiningTable.configuration.respond_to?( presenter )
    DiningTable.configuration.send( presenter ).default_options
  else
    { }
  end
end