module Parse
Public Instance Methods
hash_array_to_column_hash(hash_array)
click to toggle source
# File lib/poisol/utils/parse.rb, line 17 def hash_array_to_column_hash hash_array return [] if hash_array.blank? column_hash = Hash.new hash_array[0].each_key { |key| column_hash.merge!(key=>[])} hash_array.each do |hash| column_hash.each_key {|key| column_hash[key].append hash[key]} end column_hash end
hash_to_concatenated_key_value(hash)
click to toggle source
# File lib/poisol/utils/parse.rb, line 27 def hash_to_concatenated_key_value hash RestClient::Utils.encode_query_string hash end
json_file_to_hash(file_name)
click to toggle source
# File lib/poisol/utils/parse.rb, line 4 def json_file_to_hash file_name JSON.parse File.read(file_name) end
json_to_hash(json)
click to toggle source
# File lib/poisol/utils/parse.rb, line 13 def json_to_hash json JSON.parse json end
yaml_file(file_name)
click to toggle source
# File lib/poisol/utils/parse.rb, line 8 def yaml_file file_name require 'yaml' YAML.load_file(file_name) end