Class Excesselt::ElementWrapper
In: lib/excesselt/element_wrapper.rb
Parent: Object

Methods

add   child_content   error   method_missing   new  

Attributes

builder  [R] 
element  [R] 
stylesheet  [R] 

Public Class methods

[Source]

# File lib/excesselt/element_wrapper.rb, line 6
    def initialize(stylesheet, element, builder)
      @stylesheet = stylesheet
      @element = element
      @builder = builder
    end

Public Instance methods

[Source]

# File lib/excesselt/element_wrapper.rb, line 27
    def add(*content)
      @builder << content.join('')
    end

[Source]

# File lib/excesselt/element_wrapper.rb, line 12
    def child_content(selector=nil)
      elements = selector ? @element.css(selector) : @element.children
      elements.each do |child|
        stylesheet.generate_element(child)
      end
    end

[Source]

# File lib/excesselt/element_wrapper.rb, line 31
    def error(string)
      stylesheet.errors << string
    end

[Source]

# File lib/excesselt/element_wrapper.rb, line 19
    def method_missing(sym, *args)
      begin
        @element.send(sym, *args)
      rescue Exception => e
        raise e.exception("Error delegating method '#{sym}' to #{@element.class.name}: #{e.message}\n\n#{e.backtrace.join("\n")}")
      end
    end

[Validate]