Module: AstrologicalForecast::Introduction
- Defined in:
- lib/astrological_forecast/introduction.rb
Class Method Summary collapse
Class Method Details
.init(vars) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/astrological_forecast/introduction.rb', line 5 def self.init(vars) html = URI.parse(::BASE_URL).read document = Nokogiri::HTML(html) zodiac = document.css('div.main ul > li')[vars[:number].to_i - 1] { name: zodiac.at('a .name').text, date: zodiac.at('a .per').text, head: zodiac.css(".ico-#{vars[:name_en]}") .text.strip.gsub(/\s{2,}/, ', ') .split(', ')[2] } end |