Class: EmuCtl::Target

Inherits:
Object
  • Object
show all
Defined in:
lib/emu_ctl/model.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(desc) ⇒ Target

Returns a new instance of Target.



6
7
8
9
10
11
12
13
14
# File 'lib/emu_ctl/model.rb', line 6

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

Instance Attribute Details

#abiObject

Returns the value of attribute abi.



4
5
6
# File 'lib/emu_ctl/model.rb', line 4

def abi
  @abi
end

#api_lvlObject

Returns the value of attribute api_lvl.



4
5
6
# File 'lib/emu_ctl/model.rb', line 4

def api_lvl
  @api_lvl
end

#idObject

Returns the value of attribute id.



4
5
6
# File 'lib/emu_ctl/model.rb', line 4

def id
  @id
end

#nameObject

Returns the value of attribute name.



4
5
6
# File 'lib/emu_ctl/model.rb', line 4

def name
  @name
end

#skinsObject

Returns the value of attribute skins.



4
5
6
# File 'lib/emu_ctl/model.rb', line 4

def skins
  @skins
end

Instance Method Details

#to_sObject



16
17
18
# File 'lib/emu_ctl/model.rb', line 16

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