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
195:     def initialize(builder, sym)
196:       @builder, @sym, @attrs = builder, sym, {}
197:     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
201:     def method_missing(id_or_class, *args, &block)
202:       if (idc = id_or_class.to_s) =~ /!$/
203:         @attrs[:id] = $`
204:       else
205:         @attrs[:class] = @attrs[:class].nil? ? idc : "#{@attrs[:class]} #{idc}".strip
206:       end
207: 
208:       if block or args.any?
209:         args.push(@attrs)
210:         return @builder.tag!(@sym, *args, &block)
211:       end
212: 
213:       return self
214:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.