Class: Minpaso::PCInfo

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

Overview

PCInfo shows PC detail informations.

Defined Under Namespace

Classes: CPU, Graphics, HDD, Memory, System

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, guess_score = true) ⇒ PCInfo

Returns a new instance of PCInfo.



122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# File 'lib/minpaso.rb', line 122

def initialize(id, guess_score = true)
  @id = id
  @guess_score = guess_score
  uri = URI.parse("http://minpaso.goga.co.jp/api/pc.php?id=#{@id.to_s}&e=#{guess_score}")
  doc = REXML::Document.new(uri.read)
  doc.root.elements.each do |elt|
    case elt.name
    when "System"; @system = System.new(elt)
    when "Cpu"; @cpu = CPU.new(elt)
    when "Graphics"; @graphics = Graphics.new(elt)
    when "Memory"; @memory = Memory.new(elt)
    when "Hdd"; @hdd = HDD.new(elt)
    end
  end
end

Instance Attribute Details

#cpuObject (readonly)

Returns the value of attribute cpu.



120
121
122
# File 'lib/minpaso.rb', line 120

def cpu
  @cpu
end

#graphicsObject (readonly)

Returns the value of attribute graphics.



120
121
122
# File 'lib/minpaso.rb', line 120

def graphics
  @graphics
end

#guess_scoreObject (readonly)

Returns the value of attribute guess_score.



120
121
122
# File 'lib/minpaso.rb', line 120

def guess_score
  @guess_score
end

#hddObject (readonly)

Returns the value of attribute hdd.



120
121
122
# File 'lib/minpaso.rb', line 120

def hdd
  @hdd
end

#idObject (readonly)

Returns the value of attribute id.



120
121
122
# File 'lib/minpaso.rb', line 120

def id
  @id
end

#memoryObject (readonly)

Returns the value of attribute memory.



120
121
122
# File 'lib/minpaso.rb', line 120

def memory
  @memory
end

#systemObject (readonly)

Returns the value of attribute system.



120
121
122
# File 'lib/minpaso.rb', line 120

def system
  @system
end