Class: Ffprober::Parsers::UrlParser

Inherits:
Object
  • Object
show all
Defined in:
lib/ffprober/parsers/url.rb

Constant Summary collapse

VALID_URI_REGEX =
/\A#{URI::DEFAULT_PARSER.make_regexp}\z/

Instance Method Summary collapse

Constructor Details

#initialize(url_to_parse, exec = Ffprober::Ffmpeg::Exec.new) ⇒ UrlParser

Returns a new instance of UrlParser.



10
11
12
13
14
15
16
17
# File 'lib/ffprober/parsers/url.rb', line 10

def initialize(url_to_parse, exec = Ffprober::Ffmpeg::Exec.new)
  unless valid_url?(url_to_parse)
    raise ArgumentError, "#{url_to_parse} is not a valid URL"
  end

  @url_to_parse = url_to_parse
  @exec = exec
end

Instance Method Details

#loadObject



19
20
21
# File 'lib/ffprober/parsers/url.rb', line 19

def load
  JsonParser.new(@exec.json_output(@url_to_parse))
end