Class: Sightstone::RunePage

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

Overview

Class to represent a page of a runebook

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ RunePage

Returns a new instance of RunePage.



27
28
29
30
31
32
33
34
35
36
37
# File 'lib/sightstone/runebook.rb', line 27

def initialize(data)
  @id = data['id']
  @name = data['name']
  @current = data['current']
  @slots = {}
  if(data.has_key? 'slots')
    data['slots'].each do |slot|
      @slots[slot['runeSlotId']] = Rune.new(slot['rune'])
    end
  end
end

Instance Attribute Details

#currentBoolean

indicates if the page is selected

Returns:

  • (Boolean)

    the current value of current



24
25
26
# File 'lib/sightstone/runebook.rb', line 24

def current
  @current
end

#idNumeric

ID of the page

Returns:

  • (Numeric)

    the current value of id



24
25
26
# File 'lib/sightstone/runebook.rb', line 24

def id
  @id
end

#nameString

page name

Returns:

  • (String)

    the current value of name



24
25
26
# File 'lib/sightstone/runebook.rb', line 24

def name
  @name
end

#slotsHash<Numeric, Rune>

matches slot ids to the rune

Returns:

  • (Hash<Numeric, Rune>)

    the current value of slots



24
25
26
# File 'lib/sightstone/runebook.rb', line 24

def slots
  @slots
end