Class: DcRenderer

Inherits:
Object
  • Object
show all
Defined in:
app/renderers/dc_renderer.rb

Overview

This is abstract renderer class definition which can be reused by other renders.

Direct Known Subclasses

DcCaptchaRenderer, DcCommonRenderer

Instance Method Summary collapse

Constructor Details

#initialize(parent, opts = {}) ⇒ DcRenderer

Object initialization.



33
34
35
36
37
38
39
# File 'app/renderers/dc_renderer.rb', line 33

def initialize( parent, opts={} )
  @parent   = parent
  @page     = parent.page
  @opts     = opts
  @css = ''
  self
end

Instance Method Details

#render_cssObject

Return CSS part of code.



54
55
56
# File 'app/renderers/dc_renderer.rb', line 54

def render_css
  @css
end

#render_htmlObject

Renderer dispatcher. Method returns HTML part of code.



44
45
46
47
48
49
# File 'app/renderers/dc_renderer.rb', line 44

def render_html
  can_view, msg = @parent.dc_user_can_view(@parent, @parent.page)
  return msg unless can_view
  method = @opts[:method] || 'default'
  respond_to?(method) ? send(method) : "#{self.class}: Method (#{method}) not defined!"
end