class Cleaner
Attributes
action[RW]
data[RW]
Public Class Methods
clean_array(array, &b)
click to toggle source
# File lib/suds/cleaner.rb, line 9 def self.clean_array array, &b raise "Please provide either a hash or an array as the main parameter" unless Array === array array.each do |row| clean_hash row, &b end return array end
clean_hash(hash, &b)
click to toggle source
# File lib/suds/cleaner.rb, line 17 def self.clean_hash hash, &b raise "Please provide either a hash or an array as the main parameter" unless Hash === hash hash.each do |k,v| b.call(k,v) end return hash end
new(&b)
click to toggle source
# File lib/suds/cleaner.rb, line 5 def initialize &b block_given? ? @action = b : raise("The generic Cleaner must be provided a block.") end
Public Instance Methods
clean(data)
click to toggle source
# File lib/suds/cleaner.rb, line 26 def clean data @data = data self.class.clean_array(@data) do |k,v| @action.call(k,v) end end