Module: AdbSdkLib::Common

Included in:
Adb, Device
Defined in:
lib/adb_sdklib/common.rb

Class Method Summary collapse

Class Method Details

.convert_map_to_hash(object, &block) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/adb_sdklib/common.rb', line 13

def convert_map_to_hash(object, &block)
  hash = Hash.new
  i = object.entrySet.iterator
  if block_given?
    while i.hasNext
      entry = i.next
      yield hash, entry.getKey, entry.getValue
    end
  else
    while i.hasNext
      entry = i.next
      hash[entry.getKey] = entry.getValue
    end
  end
  hash
end

.load_jar(lib) ⇒ Object

Raises:



8
9
10
11
# File 'lib/adb_sdklib/common.rb', line 8

def load_jar(lib)
  raise AdbError, "Not found #{lib}" unless File.exist?(lib)
  Rjb::load(lib)
end