class Mockolate::Request::Parser
Attributes
_attr_arr[R]
_export_key[R]
Public Class Methods
new(attr_arr, options = {})
click to toggle source
# File lib/mockolate/request/parser.rb, line 7 def initialize(attr_arr, options = {}) @_attr_arr = attr_arr @_export_key = options[:export_with] end
Public Instance Methods
parse()
click to toggle source
# File lib/mockolate/request/parser.rb, line 12 def parse return _parse_to_hash if _export_key _parse_to_array end
Private Instance Methods
_parse_to_array()
click to toggle source
# File lib/mockolate/request/parser.rb, line 30 def _parse_to_array _attr_arr.map do |attr| _hash = Hash.new attr.each do |t| _hash.merge! t.parse end _hash end end
_parse_to_hash()
click to toggle source
# File lib/mockolate/request/parser.rb, line 18 def _parse_to_hash export_hash = {} _attr_arr.each do |attr| hash = {} attr.each do |t| hash.merge! t.parse end export_hash[hash[_export_key]] = hash end return export_hash end