nebrija 0.0.4 → 0.1.0

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: cbe1c236cfdbcd63261e1fb1b13438cd1d2d9750
4
- data.tar.gz: ad2421bb3cfaf40bb5c9c9f0c81ad96c8edd4fcb
3
+ metadata.gz: 0c47fc0ec9b7e9e319a74a0af79a39689626025c
4
+ data.tar.gz: 36c7a4493aee48ce724bcbc600468847d51370df
5
5
  SHA512:
6
- metadata.gz: 97202fadc7d57faace94aa0a03fa7b18f21786a5056b35ab544709d03cfd7beebfe8824f29d6662d8e7e446b33b4a93914fcc0eb1db27e9799858deb169ce844
7
- data.tar.gz: 62d77bbc8bdac99998d2e99d947ec2b14b47940f6f317813e17501fe8635cff22ef5e8bbc16c7558122409b8dd68129744388a3048a4c987a50620239e55edde
6
+ metadata.gz: 1d2d58e5c86345726849f0e44841c38634a88ef096d55caf4515c3cf9019411cb91897ad0ff2d81051ec5b4c8926049c02eb394e45ead96f2196c13e05d60538
7
+ data.tar.gz: e5108b63017f9eb3b253844dcaef2f72d7958908ca9b9c990811b19f8c740ec949794abf5475b2a8658ea8ecbe40cffc6f932f1940a97b5edbfd449ce3448c37
@@ -33,17 +33,22 @@ class Parser
33
33
  word = '=>' if word == ''
34
34
  single_data << {
35
35
  :word => word.strip.capitalize, # gsub(/~/, @word)
36
- :meanings => []
36
+ :meanings => [],
37
+ :etymology => nil
37
38
  }
38
39
  index+=1
39
40
  else
40
41
  text = entry.inner_text.strip.gsub(/[0-9]+\.[ ]/, '')
41
- next if text[0] == '(' # Del latín, Nil.
42
+ if text[0] == '('
43
+ single_data[index][:etymology] = text
44
+ next
45
+ end
46
+
42
47
  unparsed_meta = text.scan META_REGEX
43
48
  text = text.gsub(META_REGEX, '')
44
49
  single_data[index][:meanings] << {
45
- :word => text,
46
- :meta => (unparsed_meta.join.strip if unparsed_meta.join.strip != ''),
50
+ :word => text,
51
+ :meta => (unparsed_meta.join.strip if unparsed_meta.join.strip != ''),
47
52
  } if !text.nil? and text != ''
48
53
  state = :definitions
49
54
  end
data/lib/nebrija.rb CHANGED
@@ -27,7 +27,6 @@ end
27
27
  class HTTPRae < Rae
28
28
  USER_AGENT = 'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2049.0 Safari/537.36'
29
29
  SEARCH_URL = 'http://lema.rae.es/drae/srv/search?'
30
- REQUEST_TIMEOUT =
31
30
  ID_REGEX = /[0-9]/
32
31
 
33
32
  private
@@ -38,7 +37,7 @@ class HTTPRae < Rae
38
37
  params = 'val=' if val?
39
38
 
40
39
  response = Typhoeus::Request.post(
41
- "http://lema.rae.es/drae/srv/search?#{params}#{word}",
40
+ "#{SEARCH_URL}#{params}#{word}",
42
41
  body: build_headers
43
42
  )
44
43
  response.body
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nebrija
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - '@javierhonduco'
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-16 00:00:00.000000000 Z
11
+ date: 2014-07-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri