Sha256: e5a534b83006f09f28ae3bc6aa23f253ac8f75627ae5a1b286a10bb9e0bb9d7e

Contents?: true

Size: 511 Bytes

Versions: 11

Compression:

Stored size: 511 Bytes

Contents

# frozen_string_literal: true

module AstrologicalForecast
  module Introduction
    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
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
astrological_forecast-2.0.5 lib/astrological_forecast/introduction.rb
astrological_forecast-2.0.4 lib/astrological_forecast/introduction.rb
astrological_forecast-2.0.2 lib/astrological_forecast/introduction.rb
astrological_forecast-2.0.1 lib/astrological_forecast/introduction.rb
astrological_forecast-1.3.5 lib/astrological_forecast/introduction.rb
astrological_forecast-1.3.4 lib/astrological_forecast/introduction.rb
astrological_forecast-1.3.3 lib/astrological_forecast/introduction.rb
astrological_forecast-1.2.3 lib/astrological_forecast/introduction.rb
astrological_forecast-1.2.2 lib/astrological_forecast/introduction.rb
astrological_forecast-1.2.1 lib/astrological_forecast/introduction.rb
astrological_forecast-1.2.0 lib/astrological_forecast/introduction.rb