Class: MediaItem

Inherits:
Object
  • Object
show all
Defined in:
lib/etvnet_seek/core/media_item.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(text, link, additional_info = nil) ⇒ MediaItem

Returns a new instance of MediaItem.



8
9
10
11
12
13
14
15
# File 'lib/etvnet_seek/core/media_item.rb', line 8

def initialize(text, link, additional_info = nil)
  @text = text
  @link = link
  @additional_info = additional_info

  @underscore_name = extract_underscore_name
  @media_file = extract_media_file
end

Instance Attribute Details

#additional_infoObject (readonly)

Returns the value of attribute additional_info.



5
6
7
# File 'lib/etvnet_seek/core/media_item.rb', line 5

def additional_info
  @additional_info
end

Returns the value of attribute link.



5
6
7
# File 'lib/etvnet_seek/core/media_item.rb', line 5

def link
  @link
end

#media_fileObject (readonly)

Returns the value of attribute media_file.



6
7
8
# File 'lib/etvnet_seek/core/media_item.rb', line 6

def media_file
  @media_file
end

#textObject (readonly)

Returns the value of attribute text.



5
6
7
# File 'lib/etvnet_seek/core/media_item.rb', line 5

def text
  @text
end

#underscore_nameObject (readonly)

Returns the value of attribute underscore_name.



6
7
8
# File 'lib/etvnet_seek/core/media_item.rb', line 6

def underscore_name
  @underscore_name
end

Instance Method Details

#==(object) ⇒ Object



33
34
35
# File 'lib/etvnet_seek/core/media_item.rb', line 33

def ==(object)
  object.text == text and object.link == link
end

#access_page?Boolean

def has_media_links?

  page = Page.new link

  page.document.css("b a.media_file").size > 0
end

Returns:

  • (Boolean)


27
28
29
30
31
# File 'lib/etvnet_seek/core/media_item.rb', line 27

def access_page?
  page = Page.new link

  page.document.css(".start-video start-movie").size > 0
end

#folder?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/etvnet_seek/core/media_item.rb', line 17

def folder?
  false
end

#to_sObject



37
38
39
# File 'lib/etvnet_seek/core/media_item.rb', line 37

def to_s
  text
end