Module: DeclarativeGrid::Renderers

Included in:
Base
Defined in:
lib/declarative_grid/renderers.rb,
lib/declarative_grid/renderers/csv.rb,
lib/declarative_grid/renderers/html.rb,
lib/declarative_grid/renderers/abstract_renderer.rb

Defined Under Namespace

Classes: AbstractRenderer, Csv, Html

Instance Method Summary collapse

Instance Method Details

#renderer(name, options = {}) ⇒ Object

Define a renderer



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/declarative_grid/renderers.rb', line 9

def renderer(name, options = {})
  klass = Class.new begin
    case k = options.delete(:class)
    when Class then k
    when String then k.camelize.constantize
    else "declarative_grid/renderers/#{k || name}".camelize.constantize
    end
  end
  klass.grid_class = self
  klass.options.merge! options
  self.renderer_classes[name] = klass
end

#renderer_classesObject

Renderer Classes



4
5
6
# File 'lib/declarative_grid/renderers.rb', line 4

def renderer_classes
  @renderer_classes ||= {}
end