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.
Creates a CssProxy object.
# File lib/hpricot/builder.rb, line 194
194: def initialize(builder, sym)
195: @builder, @sym, @attrs = builder, sym, {}
196: end
Adds attributes to an element. Bang methods set the :id attribute. Other methods add to the :class attribute.
# File lib/hpricot/builder.rb, line 200
200: def method_missing(id_or_class, *args, &block)
201: if (idc = id_or_class.to_s) =~ /!$/
202: @attrs[:id] = $`
203: else
204: @attrs[:class] = @attrs[:class].nil? ? idc : "#{@attrs[:class]} #{idc}".strip
205: end
206:
207: if block or args.any?
208: args.push(@attrs)
209: return @builder.tag!(@sym, *args, &block)
210: end
211:
212: return self
213: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.