Class: Sites::ElixirCompanies
- Defined in:
- lib/sites/elixir_companies.rb
Constant Summary collapse
- HOST =
'https://elixir-companies.com'.freeze
- PATH =
'/en/browse'.freeze
- JOB_ITEM_SELECTOR =
'div.company.box'.freeze
- STORE_DIR =
'data/elixir_companies'.freeze
Instance Attribute Summary
Attributes inherited from Base
#doc, #jobs_count, #rows_count, #url
Instance Method Summary collapse
- #collect_companies(limit: nil) ⇒ Object
- #companies_count ⇒ Object
-
#initialize ⇒ ElixirCompanies
constructor
A new instance of ElixirCompanies.
Constructor Details
#initialize ⇒ ElixirCompanies
Returns a new instance of ElixirCompanies.
11 12 13 14 15 16 17 18 19 |
# File 'lib/sites/elixir_companies.rb', line 11 def initialize @url = "#{self.class::HOST}#{self.class::PATH}" @current_time = Time.now @timestamp = @current_time.strftime("%Y%m%d%H%M%S") @doc = nil @total_pages = 26 @rows_count = 0 @jobs_count = get_jobs_count end |
Instance Method Details
#collect_companies(limit: nil) ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/sites/elixir_companies.rb', line 21 def collect_companies(limit: nil) FileUtils.mkdir_p STORE_DIR (1..@total_pages).each do |page| process_page(page: page, limit: limit) end end |
#companies_count ⇒ Object
29 30 31 |
# File 'lib/sites/elixir_companies.rb', line 29 def companies_count @rows_count end |