Parent

Class/Module Index [+]

Quicksearch

FeedTools::Enclosure

This class stores information about a feed item's file enclosures.

Attributes

bitrate[RW]

The bitrate of the enclosed media

categories[RW]

The categories for this enclosure

credits[RW]

A list of credits for the enclosed media

default_version[RW]

The default version of the enclosed media file

duration[RW]

The total play time of the file referenced by the enclosure

file_size[RW]

The size of the file referenced by the enclosure

framerate[RW]

The framerate of the enclosed media

hash[RW]

A hash of the enclosed file

height[RW]

The height in pixels of the enclosed media

href[RW]

The url for the enclosure

player[RW]

A website containing some kind of media player instead of a direct link to the media file.

text[RW]

A text rendition of the enclosed media

thumbnail[RW]

The thumbnail for this enclosure

type[RW]

The MIME type of the file referenced by the enclosure

url[RW]

The url for the enclosure

url=[RW]

The url for the enclosure

versions[RW]

A list of alternate version of the enclosed media file

width[RW]

The width in pixels of the enclosed media

Public Class Methods

new() click to toggle source
# File lib/feed_tools/feed_structures.rb, line 174
def initialize
  @expression = 'full'
end

Public Instance Methods

audio?() click to toggle source

Returns true if this enclosure contains audio content

# File lib/feed_tools/feed_structures.rb, line 215
def audio?
  unless self.type.nil?
    return true if (self.type =~ /^audio/) != nil
  end
  # TODO: create a more complete list
  # =================================
  audio_extensions = ['mp3', 'm4a', 'm4p', 'wav', 'ogg', 'wma']
  audio_extensions.each do |extension|
    if (url =~ /#{extension}$/) != nil
      return true
    end
  end
  return false
end
explicit=(new_explicit) click to toggle source

Sets the explicit attribute on the enclosure

# File lib/feed_tools/feed_structures.rb, line 194
def explicit=(new_explicit)
  @explicit = new_explicit
end
explicit?() click to toggle source

Returns true if the enclosure contains explicit material

# File lib/feed_tools/feed_structures.rb, line 189
def explicit?
  return @explicit
end
expression() click to toggle source

Determines if the object is a sample, or the full version of the object, or if it is a stream. Possible values are 'sample', 'full', 'nonstop'.

# File lib/feed_tools/feed_structures.rb, line 201
def expression
  return @expression
end
expression=(new_expression) click to toggle source

Sets the expression attribute on the enclosure. Allowed values are 'sample', 'full', 'nonstop'.

# File lib/feed_tools/feed_structures.rb, line 207
def expression=(new_expression)
  unless ['sample', 'full', 'nonstop'].include? new_expression.downcase
    return @expression
  end
  @expression = new_expression.downcase
end
is_default=(new_is_default) click to toggle source

Sets whether this is the default enclosure for the media group

# File lib/feed_tools/feed_structures.rb, line 184
def is_default=(new_is_default)
  @is_default = new_is_default
end
is_default?() click to toggle source

Returns true if this is the default enclosure

# File lib/feed_tools/feed_structures.rb, line 179
def is_default?
  return @is_default
end
video?() click to toggle source

Returns true if this enclosure contains video content

# File lib/feed_tools/feed_structures.rb, line 231
def video?
  unless self.type.nil?
    return true if (self.type =~ /^video/) != nil
    return true if self.type == "image/mov"
  end
  # TODO: create a more complete list
  # =================================
  video_extensions = ['mov', 'mp4', 'avi', 'wmv', 'asf']
  video_extensions.each do |extension|
    if (url =~ /#{extension}$/) != nil
      return true
    end
  end
  return false
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.