Sha256: e11ca5b0cbd67eca2d5f91031ba6dcb8287fcf45c3e8d92af154bad36f2d712f

Contents?: true

Size: 1.3 KB

Versions: 1

Compression:

Stored size: 1.3 KB

Contents

module EmuCtl

  class Target
    attr_accessor(:id, :name, :skins, :abi, :api_lvl)

    def initialize(desc)
      @lines = desc.split("\n")
      @id = /id: \d+ .* "(.+)"/.match(desc)[1]
      @name = /Name: (.+)/.match(desc)[1]
      @skins = /Skins: (.*)/.match(desc)[1].split(',').map{|n| n.strip}
      @abi = /ABIs : (.+)/.match(desc)[1]
      @abi = nil if @abi.include?('no ABIs.')
      @api_lvl = /API level.? (\d+)/.match(desc)[1].to_i
    end

    def to_s
      "#{@id}\n\tName: #{@name}\n\t#{@skins}\n\tABI: #{abi}"
    end
  end

  class Avd
    attr_accessor(:name, :target, :abi, :skin)

    def initialize(desc)
      @lines = desc.split("\n")
      @name = /Name: (.+)/.match(desc)[1]
      @skin = /Skin: (.+)/.match(desc)[1]
      @target = /Target: (.+)/.match(desc)[1]
      @abi = /Tag\/ABI: (.+)/.match(desc)[1]
    end

    def has_id?(id)
      puts "checking me '#{@name}' for '#{id}'"
      @name.include?(id)
    end

    def to_s
      "#{@name}"
    end
  end

  class Emulator
    attr_accessor(:qualifier, :api_lvl, :os_name, :sdk)

    def initialize(qual, api_lvl, os_name, sdk)
      @qualifier = qual
      @api_lvl = api_lvl
      @os_name = os_name
      @sdk = sdk
    end

    def to_s
      "#{qualifier}: Running #{os_name} on API Level #{api_lvl} with sdk #{sdk}"
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
emu_ctl-0.0.3 lib/emu_ctl/model.rb