Module: XRuntime::Utils

Defined in:
lib/x_runtime/utils.rb

Class Method Summary collapse

Class Method Details

.array_hashifyObject



11
12
13
14
15
16
17
18
19
# File 'lib/x_runtime/utils.rb', line 11

def array_hashify
  lambda { |array|
    hash = Hash.new
    array.each_slice(2) do |field, value|
      hash[field] = value
    end
    hash
  }
end

.to_hash(data) ⇒ Object



4
5
6
7
8
9
# File 'lib/x_runtime/utils.rb', line 4

def to_hash(data)
  case data
  when Array
    array_hashify.call(data)
  end
end