Class: DcRenderer

Inherits:
Object
  • Object
show all
Defined in:
app/helpers/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
# File 'app/helpers/dc_renderer.rb', line 33

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

Instance Method Details

#render_cssObject

Return CSS part of code.



53
54
55
# File 'app/helpers/dc_renderer.rb', line 53

def render_css
  @css
end

#render_htmlObject

Renderer dispatcher. Method returns HTML part of code.



43
44
45
46
47
48
# File 'app/helpers/dc_renderer.rb', line 43

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