Class: MediaItem
- Inherits:
-
Object
- Object
- MediaItem
- Defined in:
- lib/etvnet_seek/core/media_item.rb
Direct Known Subclasses
BrowseMediaItem, CatalogItem, ChannelMediaItem, GroupMediaItem, NewItem
Instance Attribute Summary collapse
-
#additional_info ⇒ Object
readonly
Returns the value of attribute additional_info.
-
#link ⇒ Object
readonly
Returns the value of attribute link.
-
#media_file ⇒ Object
readonly
Returns the value of attribute media_file.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
-
#underscore_name ⇒ Object
readonly
Returns the value of attribute underscore_name.
Instance Method Summary collapse
- #==(object) ⇒ Object
-
#access_page? ⇒ Boolean
def has_media_links? page = Page.new link.
- #folder? ⇒ Boolean
-
#initialize(text, link, additional_info = nil) ⇒ MediaItem
constructor
A new instance of MediaItem.
- #to_s ⇒ Object
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_info ⇒ Object (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 |
#link ⇒ Object (readonly)
Returns the value of attribute link.
5 6 7 |
# File 'lib/etvnet_seek/core/media_item.rb', line 5 def link @link end |
#media_file ⇒ Object (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 |
#text ⇒ Object (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_name ⇒ Object (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
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
17 18 19 |
# File 'lib/etvnet_seek/core/media_item.rb', line 17 def folder? false end |
#to_s ⇒ Object
37 38 39 |
# File 'lib/etvnet_seek/core/media_item.rb', line 37 def to_s text end |