domainatrix 0.0.8 → 0.0.9

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.
data/lib/domainatrix.rb CHANGED
@@ -5,7 +5,7 @@ require 'domainatrix/domain_parser.rb'
5
5
  require 'domainatrix/url.rb'
6
6
 
7
7
  module Domainatrix
8
- VERSION = "0.0.8"
8
+ VERSION = "0.0.9"
9
9
  DOMAIN_PARSER = DomainParser.new("#{File.dirname(__FILE__)}/effective_tld_names.dat")
10
10
 
11
11
  def self.parse(url)
@@ -10,7 +10,14 @@ module Domainatrix
10
10
  end
11
11
 
12
12
  def read_dat_file(file_name)
13
- File.readlines(file_name).each do |line|
13
+ # If we're in 1.9, make sure we're opening it in UTF-8
14
+ if RUBY_VERSION >= '1.9'
15
+ dat_file = File.open(file_name, "r:UTF-8")
16
+ else
17
+ dat_file = File.open(file_name)
18
+ end
19
+
20
+ dat_file.each_line do |line|
14
21
  line = line.strip
15
22
  unless (line =~ /\/\//) || line.empty?
16
23
  parts = line.split(".").reverse
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: domainatrix
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.8
5
+ version: 0.0.9
6
6
  platform: ruby
7
7
  authors:
8
8
  - Paul Dix