module Galadriel
Constants
- VERSION
- VERSION_INFO
Attributes
hash_array[RW]
Public Class Methods
assign_values(hash)
click to toggle source
Assign values to hash array Require hash array created Work if value dont is nested value
# File lib/galadriel.rb, line 28 def self.assign_values(hash) hash.each_pair do |key, values| values.each_with_index do |value, index| self.hash_array[index][key.to_sym] = value end end end
create_hash(hash)
click to toggle source
Create an has with all keys based params keys
# File lib/galadriel.rb, line 47 def self.create_hash(hash) new_hash = Hash.new hash.each_pair do |key| new_hash[key] = nil end new_hash.symbolize_keys end
create_hash_array(hash)
click to toggle source
Create hash array based hash with null values using create_hash
# File lib/galadriel.rb, line 37 def self.create_hash_array(hash) hash.each_pair do |key, values| values.each do |value| self.hash_array.push(create_hash(hash)) end break end end
parse(params_value, debug = false)
click to toggle source
# File lib/galadriel.rb, line 9 def self.parse(params_value, debug = false) # initialize hash array to array self.hash_array = [] # to generate hash array create_hash_array(params_value) # to assign values to hash array assign_values(params_value) show_debug(debug) self.hash_array end
show_debug(show)
click to toggle source
# File lib/galadriel.rb, line 55 def self.show_debug(show) puts JSON.pretty_generate(self.hash_array) if show end
version()
click to toggle source
# File lib/galadriel/version.rb, line 5 def self.version VERSION end