humans_rb 0.0.1 → 0.0.2

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: 23eb23b10bd8b468d79895cc4d10366847413d93
4
- data.tar.gz: 03a17e007a29bb8643a2e32340dd24bf5128cc17
3
+ metadata.gz: 31b3837efb29afc20a4f3aa6f39920fc898d3254
4
+ data.tar.gz: 47a5f07517c293edefb26a7280b50214db3e40e6
5
5
  SHA512:
6
- metadata.gz: 909d80dac1b89cd2889c122d245be9dfa7324127c878c9012d6f2549e5b2d164b42504499ed38b0ccf4681a06c50dee10b7f7cf3d2824eaa6db6024a2b8f3c32
7
- data.tar.gz: cf2101978234a73850f2b93ada1d165a5816f7e821603abbf15cd0194773ec740f55025106c0d2baab1cfb88db1d38b2faf2608ae1331b6d9c944e82496b9b1a
6
+ metadata.gz: e801c5cda34580bc115be26192166688840c103805b29912929cea5df0e3d815bdf66c6df8faebfdb6fb891f5376a76efa3ebd751300c3382b56507482e7ed08
7
+ data.tar.gz: f0dd43a448f032183953f64f051e1ae7e4ffa9c55db698d28273937c92e16b0c24405cf1faeeeea980ec082791336db5c5b3d3227b54186b933b431653db62e7
data/humans_rb.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  # coding: utf-8
2
2
  lib = File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'humans/version'
4
+ require 'humans_rb/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "humans_rb"
File without changes
File without changes
@@ -0,0 +1,3 @@
1
+ class HumansRb
2
+ VERSION = "0.0.2"
3
+ end
@@ -1,8 +1,7 @@
1
1
  require 'typhoeus'
2
2
  require 'parslet'
3
- require "humans/version"
4
- require "humans/parser"
5
- require "humans/transform"
3
+ require "humans_rb/parser"
4
+ require "humans_rb/transform"
6
5
 
7
6
  class HumansRb
8
7
  def initialize(url_or_string)
@@ -10,11 +9,12 @@ class HumansRb
10
9
  end
11
10
 
12
11
  def body
13
- if @url_or_string =~ /^http/
12
+ @body ||= if @url_or_string =~ /^http/
14
13
  @url_or_string << "/humans.txt" if !(@url_or_string =~ /humans\.txt$/)
15
- @url_or_string = Typhoeus.get(@url_or_string, accept_encoding: "gzip").body
14
+ @url_or_string = Typhoeus.get(@url_or_string, accept_encoding: "gzip").body.
15
+ encode('UTF-8', {:invalid => :replace, :undef => :replace, :replace => '?'})
16
16
  else
17
- @url_or_string
17
+ @url_or_string.encode('UTF-8', {:invalid => :replace, :undef => :replace, :replace => '?'})
18
18
  end
19
19
  end
20
20
 
data/spec/spec_helper.rb CHANGED
@@ -6,7 +6,7 @@ $:.push File.join(File.dirname(__FILE__), '..', 'lib')
6
6
 
7
7
  require 'webmock/rspec'
8
8
 
9
- require_relative "../lib/humans"
9
+ require_relative "../lib/humans_rb"
10
10
 
11
11
  WebMock.disable_net_connect!
12
12
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: humans_rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Balter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-14 00:00:00.000000000 Z
11
+ date: 2015-03-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus
@@ -122,10 +122,10 @@ files:
122
122
  - README.md
123
123
  - Rakefile
124
124
  - humans_rb.gemspec
125
- - lib/humans.rb
126
- - lib/humans/parser.rb
127
- - lib/humans/transform.rb
128
- - lib/humans/version.rb
125
+ - lib/humans_rb.rb
126
+ - lib/humans_rb/parser.rb
127
+ - lib/humans_rb/transform.rb
128
+ - lib/humans_rb/version.rb
129
129
  - script/bootstrap
130
130
  - script/cibuild
131
131
  - script/console
@@ -1,3 +0,0 @@
1
- class HumansRb
2
- VERSION = "0.0.1"
3
- end