Class: RollForInitiative::Scraper
- Inherits:
-
Object
- Object
- RollForInitiative::Scraper
- Defined in:
- lib/roll_for_initiative/scraper.rb
Constant Summary collapse
- @@site =
"https://www.dndbeyond.com/classes"
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.doc ⇒ Object
22 23 24 |
# File 'lib/roll_for_initiative/scraper.rb', line 22 def self.doc @@doc end |
.encounter ⇒ Object
26 27 28 |
# File 'lib/roll_for_initiative/scraper.rb', line 26 def self.encounter @@encounter end |
.fight ⇒ Object
30 31 32 |
# File 'lib/roll_for_initiative/scraper.rb', line 30 def self.fight @@fight end |
Instance Method Details
#grab_encounter(site) ⇒ Object
11 12 13 14 15 |
# File 'lib/roll_for_initiative/scraper.rb', line 11 def grab_encounter(site) more_info = Nokogiri::HTML(open(site, "User-Agent" => "Mozilla/5.0 (Windows NT 6.0; rv:12.0) Gecko/20100101 Firefox/12.0 FirePHP/0.7.1")) @@encounter = more_info.search(".content-container p")[1].text end |
#klasses(site) ⇒ Object
5 6 7 8 9 |
# File 'lib/roll_for_initiative/scraper.rb', line 5 def klasses(site) @@doc = Nokogiri::HTML(open(site, "User-Agent" => "Mozilla/5.0 (Windows NT 6.0; rv:12.0) Gecko/20100101 Firefox/12.0 FirePHP/0.7.1")) end |
#who_you_fight ⇒ Object
17 18 19 20 |
# File 'lib/roll_for_initiative/scraper.rb', line 17 def who_you_fight oppenent = Nokogiri::HTML(open("http://www.chaoticshiny.com/monstergen.php")) @@fight = oppenent.search("#output").text.strip end |