class DTK::Client::PostBody
Public Class Methods
new(raw={})
click to toggle source
Calls superclass method
# File lib/auxiliary.rb, line 31 def initialize(raw={}) super() unless raw.empty? replace(convert(raw)) end end
Public Instance Methods
merge(raw)
click to toggle source
Calls superclass method
# File lib/auxiliary.rb, line 37 def merge(raw) super(convert(raw)) end
merge!(raw)
click to toggle source
Calls superclass method
# File lib/auxiliary.rb, line 40 def merge!(raw) super(convert(raw)) end
Private Instance Methods
convert(raw)
click to toggle source
# File lib/auxiliary.rb, line 45 def convert(raw) raw.inject(Hash.new) do |h,(k,v)| if non_null_var = is_only_non_null_var?(k) v.nil? ? h : h.merge(non_null_var => v) else h.merge(k => v) end end end
is_only_non_null_var?(k)
click to toggle source
# File lib/auxiliary.rb, line 54 def is_only_non_null_var?(k) if k.to_s =~ /\?$/ k.to_s.gsub(/\?$/,'').to_sym end end