Class: Yt::Models::URL

Inherits:
Object
  • Object
show all
Defined in:
lib/yt/models/url.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url) ⇒ URL

Returns a new instance of URL.



6
7
8
9
10
# File 'lib/yt/models/url.rb', line 6

def initialize(url)
  @url = url
  @kind ||= parse url
  @match_data ||= {}
end

Instance Attribute Details

#kindObject (readonly)

Returns the value of attribute kind.



4
5
6
# File 'lib/yt/models/url.rb', line 4

def kind
  @kind
end

Instance Method Details

#idObject



12
13
14
15
# File 'lib/yt/models/url.rb', line 12

def id
  @match_data[:id]
rescue IndexError
end

#usernameObject



17
18
19
20
# File 'lib/yt/models/url.rb', line 17

def username
  @match_data[:username]
rescue IndexError
end