Method: QueryDef#to_h
- Defined in:
- lib/cuca/stdlib/listwidget/querydef.rb
#to_h(attr1 = nil, newval1 = nil, attr2 = nil, newval2 = nil) ⇒ Object
returns an hash with the values and escaped names and attributes attr and newval with swap a value for this return without changing the actual data
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/cuca/stdlib/listwidget/querydef.rb', line 115 def to_h(attr1=nil, newval1=nil, attr2=nil, newval2=nil) if attr1 then @backup = @data.dup @data[attr1] = newval1 @data[attr2] = newval2 unless attr2.nil? end u = {} ATTRIBS.each do |a| # $stderr.puts "Encoding: #{a} - #{@data[a]}" u[at_enc(a)] = escape(ev_enc(a) || '') end if attr1 then @data = @backup end return u end |