Class: RollForInitiative::Klass
- Inherits:
-
Object
- Object
- RollForInitiative::Klass
- Defined in:
- lib/roll_for_initiative/klass.rb
Constant Summary collapse
- @@all =
this is the container holding the objects
[]
- @@klass_name_list =
this should be just the array of klass names as strings
[]
Instance Attribute Summary collapse
-
#klass_url ⇒ Object
Returns the value of attribute klass_url.
-
#more_info ⇒ Object
Returns the value of attribute more_info.
-
#name ⇒ Object
Returns the value of attribute name.
-
#short ⇒ Object
Returns the value of attribute short.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name) ⇒ Klass
constructor
A new instance of Klass.
Constructor Details
#initialize(name) ⇒ Klass
Returns a new instance of Klass.
11 12 13 14 |
# File 'lib/roll_for_initiative/klass.rb', line 11 def initialize(name) @name = name @@all << self end |
Instance Attribute Details
#klass_url ⇒ Object
Returns the value of attribute klass_url.
2 3 4 |
# File 'lib/roll_for_initiative/klass.rb', line 2 def klass_url @klass_url end |
#more_info ⇒ Object
Returns the value of attribute more_info.
2 3 4 |
# File 'lib/roll_for_initiative/klass.rb', line 2 def more_info @more_info end |
#name ⇒ Object
Returns the value of attribute name.
2 3 4 |
# File 'lib/roll_for_initiative/klass.rb', line 2 def name @name end |
#short ⇒ Object
Returns the value of attribute short.
2 3 4 |
# File 'lib/roll_for_initiative/klass.rb', line 2 def short @short end |
Class Method Details
.all ⇒ Object
31 32 33 |
# File 'lib/roll_for_initiative/klass.rb', line 31 def self.all @@all end |
.get_klass_names ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/roll_for_initiative/klass.rb', line 18 def self.get_klass_names klass_list = RollForInitiative::Scraper.doc.search(".listing-card__content") klass_list.each do |klass_info| new_klass = RollForInitiative::Klass.new(klass_info.search(".listing-card__title").text.strip) @@klass_name_list << klass_info.search(".listing-card__title").text.strip.downcase new_klass.short = klass_info.search(".listing-card__description p").first.text.strip new_klass.klass_url = klass_info.search("a").first["href"] #>/classes/'theclass' end end |
.klass_name_list ⇒ Object
35 36 37 |
# File 'lib/roll_for_initiative/klass.rb', line 35 def self.klass_name_list @@klass_name_list end |