lib/SVGElements/CSS/CssClass.rb
def method_missing(attr, *vals)
			attr_str = attr.to_s
			case attr_str
			when /^[a-zA-Z_]+$/
				#getter
				if @attributes.has_key? attr
					return @attributes[attr]
				else
					super(attr, *vals) #method missing
				end
				
			when /^[a-zA-Z_]+=$/
				#setter
				if vals.empty?
					raise ArgumentError, "No arguments provided to attribute setter #{attr_str}"
				end
				@attributes[attr_str.slice(0..-2).to_sym] = vals.first
				
			else
				super(attr, *vals) #method missing
			end
		end
#Override method missing to provide css attribute setters/getters.
Override method missing to provide css attribute setters/getters.
Override method missing to provide css attribute setters / getters .
def method_missing(attr, *vals)
			attr_str = attr.to_s
			case attr_str
			when /^[a-zA-Z_]+$/
				if @attributes.has_key? attr
					return @attributes[attr]
				else
					super(attr, *vals) 
				end
			when /^[a-zA-Z_]+=$/
				if vals.empty?
					raise ArgumentError, "No arguments provided to attribute setter #{attr_str}"
				end
				@attributes[attr_str.slice(0..-2).to_sym] = vals.first
			else
				super(attr, *vals) 
			end
		end
def method_missing ( attr , * vals ) attr_str = attr . to_s case attr_str when / ^[a-zA-Z_]+$ / if @attributes . has_key? attr return @attributes [ attr ] else super ( attr , * vals ) end when / ^[a-zA-Z_]+=$ / if vals . empty? raise ArgumentError , "No arguments provided to attribute setter #{attr_str}" end @attributes [ attr_str . slice ( 0 .. - 2 ) . to_sym ] = vals . first else super ( attr , * vals ) end end
Override method missing to provide css attribute setters/getters.
Override method missing to provide css attribute setters / getters .
#getter #method missing #setter #method missing
attr
vals