Class: EveOnline::Api::SolarSystems

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/eve_online/api/solar_systems.rb

Instance Method Summary collapse

Constructor Details

#initialize(fragment) ⇒ SolarSystems

Returns a new instance of SolarSystems.



7
8
9
# File 'lib/eve_online/api/solar_systems.rb', line 7

def initialize fragment
  self.fragment = fragment
end

Instance Method Details

#eachObject



11
12
13
14
15
16
17
# File 'lib/eve_online/api/solar_systems.rb', line 11

def each
  rows = fragment.xpath './row'
  rows.each do |row|
    solar_system = SolarSystem.new row
    yield solar_system
  end
end

#to_s(indent = 0) ⇒ Object



20
21
22
23
24
25
26
27
# File 'lib/eve_online/api/solar_systems.rb', line 20

def to_s indent = 0
  margin = " " * indent
  ["#{margin}Solar Systems (#{to_a.size})"].tap do |s|
    sort.each do |solar_system|
      s << solar_system.to_s(indent + 2)
    end
  end.join "\n"        
end