Sha256: 990bd91be4cff67ebe9ae4946a36bff9a478de21665b9b084ba7b01d7fadf2df

Contents?: true

Size: 997 Bytes

Versions: 1

Compression:

Stored size: 997 Bytes

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
end

Version data entries

1 entries across 1 versions & 1 rubygems

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