Sha256: 5461cc244689f1221e776bff0c6c0f4ac01614f9db5b1ef854a7e9af9aa64808

Contents?: true

Size: 574 Bytes

Versions: 3

Compression:

Stored size: 574 Bytes

Contents

module Garterbelt
  class Renderer
    attr_accessor :view
    
    def initialize(opts)
      self.view = opts[:view] || raise(ArgumentError, ":view required in initialization options")
    end
    
    # Rendering -----------------------------------------------
    def output
      view.output
    end
    
    def output=(alt_output)
      view.output = alt_output
    end
    
    def level 
      view.level
    end
    
    def indent
      ' '*level*2
    end
    
    def render
      raise NotImplementedError, "Subclasses must implement #render"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
garterbelt-0.0.7 lib/renderers/renderer.rb
garterbelt-0.0.6 lib/renderers/renderer.rb
garterbelt-0.0.5 lib/renderers/renderer.rb