1
0

lodash.rb 1010 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. module Docs
  2. class Lodash < UrlScraper
  3. self.name = 'lodash'
  4. self.slug = 'lodash'
  5. self.type = 'simple'
  6. self.links = {
  7. home: 'https://lodash.com/',
  8. code: 'https://github.com/lodash/lodash/'
  9. }
  10. html_filters.push 'lodash/entries', 'lodash/clean_html', 'title'
  11. options[:title] = 'lodash'
  12. options[:skip_links] = true
  13. options[:attribution] = <<-HTML
  14. &copy; JS Foundation and other contributors<br>
  15. Licensed under the MIT License.
  16. HTML
  17. version '4' do
  18. self.release = '4.17.10'
  19. self.base_url = "https://lodash.com/docs/#{release}"
  20. end
  21. version '3' do
  22. self.release = '3.10.1'
  23. self.base_url = "https://lodash.com/docs/#{release}"
  24. end
  25. version '2' do
  26. self.release = '2.4.2'
  27. self.base_url = "https://lodash.com/docs/#{release}"
  28. end
  29. def get_latest_version(opts)
  30. doc = fetch_doc('https://lodash.com/docs/', opts)
  31. doc.at_css('#version > option[selected]').content
  32. end
  33. end
  34. end