### Home Classes Methods

### In Files

- lib/hpricot/builder.rb

### Parent

Hpricot::BlankSlate

### Methods

- ::new
- #method_missing

### Files

- CHANGELOG
- COPYING

### Class/Module Index

Quicksearch

- Hpricot
- Hpricot::BlankSlate
- Hpricot::BogusETag::Trav
- Hpricot::Builder
- Hpricot::CData::Trav
- Hpricot::Comment::Trav
- Hpricot::Container
- Hpricot::Container::Trav
- Hpricot::Context
- Hpricot::CssProxy
- Hpricot::Doc::Trav
- Hpricot::DocType::Trav
- Hpricot::Elem::Trav
- Hpricot::EncodingError
- Hpricot::Error
- Hpricot::Leaf
- Hpricot::Leaf::Trav
- Hpricot::Name
- Hpricot::Node
- Hpricot::ProcIns::Trav
- Hpricot::Text::Trav
- Hpricot::Traverse
- Hpricot::XHTMLStrict
- Hpricot::XHTMLTransitional
- Hpricot::XMLDecl::Trav
- Kernel
- Object

No matching classes.

# Hpricot::CssProxy

Class used by Markaby::Builder to store element options. Methods called against the CssProxy object are added as element classes or IDs.

See the README for examples.

### Public Class Methods

new(builder, sym) click to toggle source

Creates a CssProxy object.

    # File lib/hpricot/builder.rb, line 195
    def initialize(builder, sym)
      @builder, @sym, @attrs = builder, sym, {}
    end

### Public Instance Methods

method_missing(id_or_class, *args, &block) click to toggle source

Adds attributes to an element. Bang methods set the :id attribute. Other methods add to the :class attribute.

    # File lib/hpricot/builder.rb, line 201
    def method_missing(id_or_class, *args, &block)
      if (idc = id_or_class.to_s) =~ /!$/
        @attrs[:id] = $`
      else
        @attrs[:class] = @attrs[:class].nil? ? idc : "#{@attrs[:class]} #{idc}".strip
      end

      if block or args.any?
        args.push(@attrs)
        return @builder.tag!(@sym, *args, &block)
      end

      return self
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.