treccani 0.2 → 0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e8f2d80621bceb5cbc9fc987df92165936f9712c
4
- data.tar.gz: 5018a24202b47be888944b7be145591cfc720805
3
+ metadata.gz: d61e90479eb0350bd2e913ee7cda4331326e6e48
4
+ data.tar.gz: a15b26b7f7a1116efea82b2d10a43bf0caefb32e
5
5
  SHA512:
6
- metadata.gz: 9566b4627fa16014c07644864a490cef9e27ffa2e74b2bc7b8308e4cc6e18ce4fa96d7f0a4ded5c97908d29e56077d4916670f38c8898e13afeb0796c6f0116e
7
- data.tar.gz: d05254fa579aff55f1ed320763f4d43c8119b69c52fff190761257fb7447264f113f30bd6e0504d236c187a0a518e243e54edb58ded8f4955627e0340ab3f4a4
6
+ metadata.gz: 20f9c7e072fe856a3c3c816355d8597e2520a1b0618aef77949faae6fc898635465f0889661533a6d06a6719bd51c927ca05c77a1c4c5fac49a5240857f141ea
7
+ data.tar.gz: aaa3c9df725b230088d3952ecd0c630f523aecbe51c657c9ede201db4ff1e4ab63bd2e8f3ca24bfab3ea3bffb207e6839a1164168b05a1343ec7c775d5cac003
@@ -10,7 +10,7 @@
10
10
 
11
11
  class Enciclopedia < Treccani
12
12
  def get(word)
13
- page = Nokogiri::HTML open("#{@server}#{get_url(word)}")
13
+ page = Nokogiri::HTML open(get_url(word))
14
14
  {}.tap { |result|
15
15
  page = page.xpath '//div[@class="spiega attacco"]/p'
16
16
  result[:lemma] = page.shift.text.strip
@@ -23,6 +23,6 @@ class Enciclopedia < Treccani
23
23
  def get_url(word)
24
24
  url = Nokogiri::HTML(open("#{@server}/enciclopedia/ricerca/#{word}/")).at_xpath('//ol[@class="listing"]/li/h2/a/@href').to_s
25
25
  raise 'Term not found.' if url.empty?
26
- url
26
+ "#{@server}#{url}"
27
27
  end
28
28
  end
@@ -10,7 +10,7 @@
10
10
 
11
11
  class Sinonimi < Treccani
12
12
  def get(word)
13
- page = Nokogiri::HTML open("#{@server}#{get_url(word)}")
13
+ page = Nokogiri::HTML open(get_url(word))
14
14
  page.at_xpath('//div[@class="spiega attacco"]/p').text.strip
15
15
  end
16
16
  alias_method :find, :get
@@ -18,6 +18,6 @@ class Sinonimi < Treccani
18
18
  def get_url(word)
19
19
  url = Nokogiri::HTML(open("#{@server}/vocabolario/ricerca/#{word}/Sinonimi_e_Contrari/")).at_xpath('//li[@class="result fs"]/h2/a/@href').to_s
20
20
  raise 'Term not found.' if url.empty?
21
- url
21
+ "#{@server}#{url}"
22
22
  end
23
23
  end
@@ -11,7 +11,7 @@
11
11
  class Vocabolario < Treccani
12
12
  def get(word)
13
13
  {}.tap { |result|
14
- page = Nokogiri::HTML open("#{@server}#{get_url(word)}")
14
+ page = Nokogiri::HTML open(get_url(word))
15
15
  wot = page.at_xpath('//div[@class="spiega attacco"]/p').to_s.split '<br><br>'
16
16
  result[:lemma] = wot.shift.remove_tags[0..-4].strip
17
17
  result[:meanings] = wot.join.split(/<strong>[0-9]\.<\/strong>/i).map { |m| m.remove_tags.strip }[1..-1]
@@ -22,6 +22,6 @@ class Vocabolario < Treccani
22
22
  def get_url(word)
23
23
  url = Nokogiri::HTML(open("#{@server}/vocabolario/tag/#{word}/")).at_xpath('//li[@class="result fs"]/h2/a/@href').to_s
24
24
  raise 'Term not found.' if url.empty?
25
- url
25
+ "#{@server}#{url}"
26
26
  end
27
27
  end
@@ -10,6 +10,6 @@
10
10
 
11
11
  class Treccani
12
12
  def self.version
13
- '0.2'
13
+ '0.3'
14
14
  end
15
15
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: treccani
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.2'
4
+ version: '0.3'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Giovanni Capuano