class Motley::AttSet
¶ ↑
Motley::AttSet
Attributes
dfns[R]
vals[R]
Public Class Methods
new(dfns)
click to toggle source
# File lib/motley.rb, line 57 def initialize(dfns) @dfns = dfns @vals = {} end
Public Instance Methods
[]=(key, val)
click to toggle source
# File lib/motley.rb, line 69 def []=(key, val) # $tm.hrm # normalize key key = key.downcase # get att definition dfn = @dfns[key] # if no definition if not dfn exc = StandardError::Plus.new('/zax/attset/no-att-definition') exc['att'] = key raise exc end # XML and HTML do not have the concept of null, so if nil is assigned, # we delete the hash element. Else we set the value if val.nil? @vals.delete(key) else @vals[key] = dfn.set(val) end end