Class: Linkser::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/linkser/parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url, options = {}) ⇒ Parser

Returns a new instance of Parser.


8
9
10
11
12
13
14
15
16
17
18
# File 'lib/linkser/parser.rb', line 8

def initialize url, options={}
  head = get_head url, options

  @object =
    case head.content_type
    when "text/html"
      Linkser::Objects::HTML.new url, last_url, head, options
    else
      Linkser::Object.new url, last_url, head, options
    end
end

Instance Attribute Details

#last_urlObject (readonly)

Returns the value of attribute last_url


6
7
8
# File 'lib/linkser/parser.rb', line 6

def last_url
  @last_url
end

#objectObject (readonly)

Returns the value of attribute object


6
7
8
# File 'lib/linkser/parser.rb', line 6

def object
  @object
end