Class: YouTubeG::Parser::FeedParser

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

Overview

:nodoc:

Direct Known Subclasses

VideoFeedParser

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(arg) ⇒ FeedParser

Accept a URL or a string assumed to be XML.



10
11
12
13
# File 'lib/youtube_g/parser.rb', line 10

def initialize(arg)                    
  @url_based = assert_valid_url(arg)
  @content = arg
end

Instance Attribute Details

#url_basedObject (readonly) Also known as: url_based?

Returns the value of attribute url_based.



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

def url_based
  @url_based
end

Instance Method Details

#parseObject



15
16
17
18
19
20
21
# File 'lib/youtube_g/parser.rb', line 15

def parse                
  if @url_based
    parse_content open(@content).read 
  else
    parse_content @content  
  end
end