Class: HumansRb
- Inherits:
-
Object
- Object
- HumansRb
- Defined in:
- lib/humans_rb.rb,
lib/humans_rb/parser.rb,
lib/humans_rb/version.rb,
lib/humans_rb/transform.rb
Defined Under Namespace
Constant Summary collapse
- VERSION =
"0.0.6"
Instance Method Summary collapse
- #body ⇒ Object
-
#initialize(url_or_string) ⇒ HumansRb
constructor
A new instance of HumansRb.
- #parse ⇒ Object
Constructor Details
#initialize(url_or_string) ⇒ HumansRb
Returns a new instance of HumansRb.
8 9 10 |
# File 'lib/humans_rb.rb', line 8 def initialize(url_or_string) @url_or_string = url_or_string end |
Instance Method Details
#body ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/humans_rb.rb', line 12 def body if @url_or_string =~ /^http/ @url_or_string << "/humans.txt" if !(@url_or_string =~ /humans\.txt$/) @url_or_string = Typhoeus.get(@url_or_string, accept_encoding: "gzip").body end normalize_string(@url_or_string) end |