log_sense 1.0.1 → 1.0.5

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
  SHA256:
3
- metadata.gz: 36209fb0a05cd3a37c53cd0ff6f69b66253657b09350d722cb4a9fdc685bdb84
4
- data.tar.gz: 25ab9b31861ce1880cdd1b024a7ec91b3a83ed77beef537253f4bfd2774214c4
3
+ metadata.gz: d4b9325a12d8ad28e8894838138be03ab5b099803af017392f5350a8582e388c
4
+ data.tar.gz: ffd4b1429a1932f8bf4e3f0abbf80ab9ce68b783fc1a1c85ffaab2599afc88c1
5
5
  SHA512:
6
- metadata.gz: fe037c3f7a3d0c61d3a2ffe62af517a1dc226714178493c47ee0e4d939c04e2eabdf641d1df84e5797623398cc80794617c5ecc054458d37b19b6f3c646d2ebf
7
- data.tar.gz: a60aece4b6ec4a5d134fa2c5a53855bba53764f8cd3603002a0d4a9ac72a3e24b5c8c845cd69c83c50a153753c6220b5f22a50648090e45e3884016926a045be
6
+ metadata.gz: 4bcbfbaf2de4977a053554c25eedeb86d738e6b988d8f5a59d531197bda5d769482c32071b0b6f56c4f07f9d20bd69ee15a171f8e52ce2824467a1ae8206a99b
7
+ data.tar.gz: b3990673bc65603ae316c98087748da05bfeba824785a41858f6e0fe37008a4519a65430938bb894b6dc1b0a93efda2c18b255bf8705be6f280687550d78576f
@@ -5,7 +5,7 @@ require 'iso_country_codes'
5
5
 
6
6
  module LogSense
7
7
  module IpLocator
8
- DB_FILE = "ip_locations/dbip-country-lite.sqlite3"
8
+ DB_FILE = File.join(File.dirname(__FILE__), "..", "..", "ip_locations", "dbip-country-lite.sqlite3")
9
9
 
10
10
  def self.dbip_to_sqlite db_location
11
11
  db = SQLite3::Database.new ":memory:"
@@ -36,7 +36,11 @@ module LogSense
36
36
  def self.locate_ip ip, db
37
37
  ip_n = IPAddr.new(ip).to_i
38
38
  res = db.execute "SELECT * FROM ip_location where from_ip_n <= #{ip_n} order by from_ip_n desc limit 1"
39
- IsoCountryCodes.find(res[0][3]).name
39
+ begin
40
+ IsoCountryCodes.find(res[0][3]).name
41
+ rescue
42
+ res[0][3]
43
+ end
40
44
  end
41
45
 
42
46
  #
@@ -218,14 +218,14 @@
218
218
  <div class="col-10 column">
219
219
  <span class="res-title">HTML:</span>
220
220
  <ul>
221
- <% urls.map { |x| x[2] }.select { |x| x.match /.*\.html?/ }.each do |url| %>
221
+ <% urls.map { |x| x[2] }.compact.select { |x| x.match /.*\.html?/ }.each do |url| %>
222
222
  <li><%= url %></li>
223
223
  <% end %>
224
224
  </ul>
225
225
 
226
226
  <span class="res-title">Other Resources:</span>
227
227
  <ul>
228
- <% urls.map { |x| x[2] }.sort.select { |x| not x.match /.*\.html?/ }.each do |url| %>
228
+ <% urls.map { |x| x[2] }.compact.sort.select { |x| x and not x.match /.*\.html?/ }.each do |url| %>
229
229
  <li><%= url %></li>
230
230
  <% end %>
231
231
  </ul>
@@ -1,3 +1,3 @@
1
1
  module LogSense
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: log_sense
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adolfo Villafiorita