Class: RSS::ITunesItemModel::ITunesDuration (Ruby 2.2.2)
Description: Class : RSS::ITunesItemModel::ITunesDuration - Ruby 2.2.2

- Home
- Core 2.2.2
- Std-lib 2.2.2
- Downloads

Support for the Ruby 2.2 series has ended. See here for reference.

### Home Classes Methods

### In Files

- rss/itunes.rb

### Parent

Element

### Methods

- ::construct
- ::new
- ::parse
- ::required_prefix
- ::required_uri
- #content=
- #full_name
- #hour=
- #minute=
- #second=
- #value=

### Included Modules

- RSS::RSS09

### Class/Module Index

Quicksearch

- RSS
- RSS::Atom
- RSS::Atom::CommonModel
- RSS::Atom::ContentModel
- RSS::Atom::ContentModel::ClassMethods
- RSS::Atom::DateConstruct
- RSS::Atom::DuplicateLinkChecker
- RSS::Atom::Entry
- RSS::Atom::Feed
- RSS::Atom::Feed::Author
- RSS::Atom::Feed::Category
- RSS::Atom::Feed::Contributor
- RSS::Atom::Feed::Entry
- RSS::Atom::Feed::Entry::Content
- RSS::Atom::Feed::Entry::Published
- RSS::Atom::Feed::Entry::Source
- RSS::Atom::Feed::Entry::Summary
- RSS::Atom::Feed::Generator
- RSS::Atom::Feed::Icon
- RSS::Atom::Feed::Id
- RSS::Atom::Feed::Link
- RSS::Atom::Feed::Logo
- RSS::Atom::Feed::Rights
- RSS::Atom::Feed::Subtitle
- RSS::Atom::Feed::Title
- RSS::Atom::Feed::Updated
- RSS::Atom::PersonConstruct
- RSS::Atom::PersonConstruct::Email
- RSS::Atom::PersonConstruct::Name
- RSS::Atom::PersonConstruct::Uri
- RSS::Atom::TextConstruct
- RSS::Atom::URIContentModel
- RSS::BaseDublinCoreModel
- RSS::BaseListener
- RSS::BaseModel
- RSS::BaseParser
- RSS::ContentModel
- RSS::ConversionError
- RSS::Converter
- RSS::DublinCoreModel
- RSS::DublincoreModel
- RSS::Element
- RSS::Error
- RSS::ITunesBaseModel
- RSS::ITunesChannelModel
- RSS::ITunesChannelModel::ITunesCategory
- RSS::ITunesChannelModel::ITunesImage
- RSS::ITunesChannelModel::ITunesOwner
- RSS::ITunesItemModel
- RSS::ITunesItemModel::ITunesDuration
- RSS::ITunesModelUtils
- RSS::ImageFaviconModel
- RSS::ImageFaviconModel::ImageFavicon
- RSS::ImageItemModel
- RSS::ImageItemModel::ImageItem
- RSS::ImageModelUtils
- RSS::InvalidRSSError
- RSS::ListenerMixin
- RSS::Maker
- RSS::Maker::Atom
- RSS::Maker::Atom::Entry
- RSS::Maker::Atom::Entry::Channel
- RSS::Maker::Atom::Entry::Channel::Cloud
- RSS::Maker::Atom::Entry::Channel::Description
- RSS::Maker::Atom::Entry::Channel::Generator
- RSS::Maker::Atom::Entry::Channel::SkipDays
- RSS::Maker::Atom::Entry::Channel::SkipDays::Day
- RSS::Maker::Atom::Entry::Channel::SkipHours
- RSS::Maker::Atom::Entry::Channel::SkipHours::Hour
- RSS::Maker::Atom::Entry::Image
- RSS::Maker::Atom::Entry::Items
- RSS::Maker::Atom::Entry::Items::Item
- RSS::Maker::Atom::Entry::Textinput
- RSS::Maker::Atom::Feed
- RSS::Maker::Atom::Feed::Channel
- RSS::Maker::Atom::Feed::Channel::Categories
- RSS::Maker::Atom::Feed::Channel::Categories::Category
- RSS::Maker::Atom::Feed::Channel::Cloud
- RSS::Maker::Atom::Feed::Channel::Generator
- RSS::Maker::Atom::Feed::Channel::Links
- RSS::Maker::Atom::Feed::Channel::Links::Link
- RSS::Maker::Atom::Feed::Channel::SkipDays
- RSS::Maker::Atom::Feed::Channel::SkipDays::Day
- RSS::Maker::Atom::Feed::Channel::SkipHours
- RSS::Maker::Atom::Feed::Channel::SkipHours::Hour
- RSS::Maker::Atom::Feed::Image
- RSS::Maker::Atom::Feed::Items
- RSS::Maker::Atom::Feed::Items::Item
- RSS::Maker::Atom::Feed::Items::Item::Categories
- RSS::Maker::Atom::Feed::Items::Item::Categories::Category
- RSS::Maker::Atom::Feed::Items::Item::Content
- RSS::Maker::Atom::Feed::Items::Item::Enclosure
- RSS::Maker::Atom::Feed::Items::Item::Guid
- RSS::Maker::Atom::Feed::Items::Item::Links
- RSS::Maker::Atom::Feed::Items::Item::Links::Link
- RSS::Maker::Atom::Feed::Items::Item::Source
- RSS::Maker::Atom::Feed::Items::Item::Source::Categories
- RSS::Maker::Atom::Feed::Items::Item::Source::Categories::Category
- RSS::Maker::Atom::Feed::Items::Item::Source::Generator
- RSS::Maker::Atom::Feed::Items::Item::Source::Icon
- RSS::Maker::Atom::Feed::Items::Item::Source::Links
- RSS::Maker::Atom::Feed::Items::Item::Source::Links::Link
- RSS::Maker::Atom::Feed::Items::Item::Source::Logo
- RSS::Maker::Atom::Feed::Textinput
- RSS::Maker::AtomCategory
- RSS::Maker::AtomGenerator
- RSS::Maker::AtomLink
- RSS::Maker::AtomLogo
- RSS::Maker::AtomPersonConstructBase
- RSS::Maker::AtomPersons
- RSS::Maker::AtomTextConstruct
- RSS::Maker::AtomTextConstructBase
- RSS::Maker::AtomTextConstructBase::EnsureXMLContent
- RSS::Maker::Base
- RSS::Maker::ChannelBase
- RSS::Maker::ChannelBase::AuthorsBase
- RSS::Maker::ChannelBase::AuthorsBase::AuthorBase
- RSS::Maker::ChannelBase::CategoriesBase
- RSS::Maker::ChannelBase::CategoriesBase::CategoryBase
- RSS::Maker::ChannelBase::CloudBase
- RSS::Maker::ChannelBase::ContributorsBase
- RSS::Maker::ChannelBase::ContributorsBase::ContributorBase
- RSS::Maker::ChannelBase::CopyrightBase
- RSS::Maker::ChannelBase::DescriptionBase
- RSS::Maker::ChannelBase::GeneratorBase
- RSS::Maker::ChannelBase::ITunesCategories
- RSS::Maker::ChannelBase::ITunesCategories::ITunesCategory
- RSS::Maker::ChannelBase::ITunesImage
- RSS::Maker::ChannelBase::ITunesOwner
- RSS::Maker::ChannelBase::LinksBase
- RSS::Maker::ChannelBase::LinksBase::LinkBase
- RSS::Maker::ChannelBase::SkipDaysBase
- RSS::Maker::ChannelBase::SkipDaysBase::DayBase
- RSS::Maker::ChannelBase::SkipHoursBase
- RSS::Maker::ChannelBase::SkipHoursBase::HourBase
- RSS::Maker::ChannelBase::TitleBase
- RSS::Maker::ContentModel
- RSS::Maker::DublinCoreModel
- RSS::Maker::ITunesBaseModel
- RSS::Maker::ITunesChannelModel
- RSS::Maker::ITunesChannelModel::ITunesCategoriesBase
- RSS::Maker::ITunesChannelModel::ITunesCategoriesBase::ITunesCategoryBase
- RSS::Maker::ITunesChannelModel::ITunesImageBase
- RSS::Maker::ITunesChannelModel::ITunesOwnerBase
- RSS::Maker::ITunesItemModel
- RSS::Maker::ITunesItemModel::ITunesDurationBase
- RSS::Maker::ImageBase
- RSS::Maker::ImageFaviconModel
- RSS::Maker::ImageFaviconModel::ImageFaviconBase
- RSS::Maker::ImageItemModel
- RSS::Maker::ImageItemModel::ImageItemBase
- RSS::Maker::ItemsBase
- RSS::Maker::ItemsBase::ItemBase
- RSS::Maker::ItemsBase::ItemBase::ContentBase
- RSS::Maker::ItemsBase::ItemBase::DescriptionBase
- RSS::Maker::ItemsBase::ItemBase::EnclosureBase
- RSS::Maker::ItemsBase::ItemBase::GuidBase
- RSS::Maker::ItemsBase::ItemBase::ITunesDuration
- RSS::Maker::ItemsBase::ItemBase::RightsBase
- RSS::Maker::ItemsBase::ItemBase::SourceBase
- RSS::Maker::ItemsBase::ItemBase::SourceBase::IconBase
- RSS::Maker::ItemsBase::ItemBase::SourceBase::LogoBase
- RSS::Maker::ItemsBase::ItemBase::SourceBase::RightsBase
- RSS::Maker::ItemsBase::ItemBase::SourceBase::SubtitleBase
- RSS::Maker::ItemsBase::ItemBase::SourceBase::TitleBase
- RSS::Maker::ItemsBase::ItemBase::TitleBase
- RSS::Maker::RSS09
- RSS::Maker::RSS091
- RSS::Maker::RSS091::Channel
- RSS::Maker::RSS091::Image
- RSS::Maker::RSS091::Items
- RSS::Maker::RSS091::Items::Item
- RSS::Maker::RSS091::Textinput
- RSS::Maker::RSS092
- RSS::Maker::RSS092::Channel
- RSS::Maker::RSS092::Image
- RSS::Maker::RSS092::Items
- RSS::Maker::RSS092::Items::Item
- RSS::Maker::RSS092::Textinput
- RSS::Maker::RSS09::Channel
- RSS::Maker::RSS09::Channel::Authors
- RSS::Maker::RSS09::Channel::Authors::Author
- RSS::Maker::RSS09::Channel::Categories
- RSS::Maker::RSS09::Channel::Categories::Category
- RSS::Maker::RSS09::Channel::Cloud
- RSS::Maker::RSS09::Channel::Contributors
- RSS::Maker::RSS09::Channel::Contributors::Contributor
- RSS::Maker::RSS09::Channel::Copyright
- RSS::Maker::RSS09::Channel::Description
- RSS::Maker::RSS09::Channel::Generator
- RSS::Maker::RSS09::Channel::Links
- RSS::Maker::RSS09::Channel::Links::Link
- RSS::Maker::RSS09::Channel::SkipDays
- RSS::Maker::RSS09::Channel::SkipDays::Day
- RSS::Maker::RSS09::Channel::SkipHours
- RSS::Maker::RSS09::Channel::SkipHours::Hour
- RSS::Maker::RSS09::Channel::Title
- RSS::Maker::RSS09::Image
- RSS::Maker::RSS09::Items
- RSS::Maker::RSS09::Items::Item
- RSS::Maker::RSS09::Items::Item::Authors
- RSS::Maker::RSS09::Items::Item::Authors::Author
- RSS::Maker::RSS09::Items::Item::Categories
- RSS::Maker::RSS09::Items::Item::Categories::Category
- RSS::Maker::RSS09::Items::Item::Content
- RSS::Maker::RSS09::Items::Item::Contributors
- RSS::Maker::RSS09::Items::Item::Contributors::Contributor
- RSS::Maker::RSS09::Items::Item::Description
- RSS::Maker::RSS09::Items::Item::Enclosure
- RSS::Maker::RSS09::Items::Item::Guid
- RSS::Maker::RSS09::Items::Item::Links
- RSS::Maker::RSS09::Items::Item::Links::Link
- RSS::Maker::RSS09::Items::Item::Rights
- RSS::Maker::RSS09::Items::Item::Source
- RSS::Maker::RSS09::Items::Item::Source::Authors
- RSS::Maker::RSS09::Items::Item::Source::Authors::Author
- RSS::Maker::RSS09::Items::Item::Source::Categories
- RSS::Maker::RSS09::Items::Item::Source::Categories::Category
- RSS::Maker::RSS09::Items::Item::Source::Contributors
- RSS::Maker::RSS09::Items::Item::Source::Contributors::Contributor
- RSS::Maker::RSS09::Items::Item::Source::Generator
- RSS::Maker::RSS09::Items::Item::Source::Icon
- RSS::Maker::RSS09::Items::Item::Source::Links
- RSS::Maker::RSS09::Items::Item::Source::Links::Link
- RSS::Maker::RSS09::Items::Item::Source::Logo
- RSS::Maker::RSS09::Items::Item::Source::Rights
- RSS::Maker::RSS09::Items::Item::Source::Subtitle
- RSS::Maker::RSS09::Items::Item::Source::Title
- RSS::Maker::RSS09::Items::Item::Title
- RSS::Maker::RSS09::Textinput
- RSS::Maker::RSS10
- RSS::Maker::RSS10::Channel
- RSS::Maker::RSS10::Channel::Authors
- RSS::Maker::RSS10::Channel::Authors::Author
- RSS::Maker::RSS10::Channel::Categories
- RSS::Maker::RSS10::Channel::Categories::Category
- RSS::Maker::RSS10::Channel::Cloud
- RSS::Maker::RSS10::Channel::Contributors
- RSS::Maker::RSS10::Channel::Contributors::Contributor
- RSS::Maker::RSS10::Channel::Copyright
- RSS::Maker::RSS10::Channel::Description
- RSS::Maker::RSS10::Channel::Generator
- RSS::Maker::RSS10::Channel::Links
- RSS::Maker::RSS10::Channel::Links::Link
- RSS::Maker::RSS10::Channel::SkipDays
- RSS::Maker::RSS10::Channel::SkipDays::Day
- RSS::Maker::RSS10::Channel::SkipHours
- RSS::Maker::RSS10::Channel::SkipHours::Hour
- RSS::Maker::RSS10::Channel::Title
- RSS::Maker::RSS10::Image
- RSS::Maker::RSS10::Items
- RSS::Maker::RSS10::Items::Item
- RSS::Maker::RSS10::Items::Item::Authors
- RSS::Maker::RSS10::Items::Item::Authors::Author
- RSS::Maker::RSS10::Items::Item::Categories
- RSS::Maker::RSS10::Items::Item::Categories::Category
- RSS::Maker::RSS10::Items::Item::Content
- RSS::Maker::RSS10::Items::Item::Contributors
- RSS::Maker::RSS10::Items::Item::Contributors::Contributor
- RSS::Maker::RSS10::Items::Item::Description
- RSS::Maker::RSS10::Items::Item::Enclosure
- RSS::Maker::RSS10::Items::Item::Guid
- RSS::Maker::RSS10::Items::Item::Links
- RSS::Maker::RSS10::Items::Item::Links::Link
- RSS::Maker::RSS10::Items::Item::Rights
- RSS::Maker::RSS10::Items::Item::Source
- RSS::Maker::RSS10::Items::Item::Source::Authors
- RSS::Maker::RSS10::Items::Item::Source::Authors::Author
- RSS::Maker::RSS10::Items::Item::Source::Categories
- RSS::Maker::RSS10::Items::Item::Source::Categories::Category
- RSS::Maker::RSS10::Items::Item::Source::Contributors
- RSS::Maker::RSS10::Items::Item::Source::Contributors::Contributor
- RSS::Maker::RSS10::Items::Item::Source::Generator
- RSS::Maker::RSS10::Items::Item::Source::Icon
- RSS::Maker::RSS10::Items::Item::Source::Links
- RSS::Maker::RSS10::Items::Item::Source::Links::Link
- RSS::Maker::RSS10::Items::Item::Source::Logo
- RSS::Maker::RSS10::Items::Item::Source::Rights
- RSS::Maker::RSS10::Items::Item::Source::Subtitle
- RSS::Maker::RSS10::Items::Item::Source::Title
- RSS::Maker::RSS10::Items::Item::Title
- RSS::Maker::RSS10::Textinput
- RSS::Maker::RSS20
- RSS::Maker::RSS20::Channel
- RSS::Maker::RSS20::Channel::Categories
- RSS::Maker::RSS20::Channel::Categories::Category
- RSS::Maker::RSS20::Channel::Cloud
- RSS::Maker::RSS20::Channel::Generator
- RSS::Maker::RSS20::Channel::SkipDays
- RSS::Maker::RSS20::Channel::SkipDays::Day
- RSS::Maker::RSS20::Channel::SkipHours
- RSS::Maker::RSS20::Channel::SkipHours::Hour
- RSS::Maker::RSS20::Image
- RSS::Maker::RSS20::Items
- RSS::Maker::RSS20::Items::Item
- RSS::Maker::RSS20::Items::Item::Authors
- RSS::Maker::RSS20::Items::Item::Authors::Author
- RSS::Maker::RSS20::Items::Item::Categories
- RSS::Maker::RSS20::Items::Item::Categories::Category
- RSS::Maker::RSS20::Items::Item::Enclosure
- RSS::Maker::RSS20::Items::Item::Guid
- RSS::Maker::RSS20::Items::Item::Source
- RSS::Maker::RSS20::Items::Item::Source::Links
- RSS::Maker::RSS20::Items::Item::Source::Links::Link
- RSS::Maker::RSS20::Textinput
- RSS::Maker::RSSBase
- RSS::Maker::SetupDefaultDate
- RSS::Maker::SetupDefaultLanguage
- RSS::Maker::SlashModel
- RSS::Maker::SyndicationModel
- RSS::Maker::TaxonomyTopicModel
- RSS::Maker::TaxonomyTopicModel::TaxonomyTopicsBase
- RSS::Maker::TaxonomyTopicModel::TaxonomyTopicsBase::TaxonomyTopicBase
- RSS::Maker::TaxonomyTopicsModel
- RSS::Maker::TaxonomyTopicsModel::TaxonomyTopicsBase
- RSS::Maker::TextinputBase
- RSS::Maker::TrackBackModel
- RSS::Maker::TrackBackModel::TrackBackAboutsBase
- RSS::Maker::TrackBackModel::TrackBackAboutsBase::TrackBackAboutBase
- RSS::Maker::XMLStyleSheets
- RSS::Maker::XMLStyleSheets::XMLStyleSheet
- RSS::MissingAttributeError
- RSS::MissingTagError
- RSS::NSError
- RSS::NotAvailableValueError
- RSS::NotExpectedTagError
- RSS::NotSetError
- RSS::NotValidXMLParser
- RSS::NotWellFormedError
- RSS::OverlappedPrefixError
- RSS::Parser
- RSS::RDF::Bag
- RSS::RDF::Bag::Li
- RSS::RDF::Channel
- RSS::RDF::Channel::Image
- RSS::RDF::Channel::Items
- RSS::RDF::Channel::Items::Seq
- RSS::RDF::Channel::Textinput
- RSS::RDF::Image
- RSS::RDF::Li
- RSS::RDF::Seq
- RSS::RDF::Seq::Li
- RSS::RDF::Textinput
- RSS::REXMLLikeXMLParser
- RSS::REXMLListener
- RSS::REXMLParser
- RSS::RSS09
- RSS::RSS10
- RSS::RootElementMixin
- RSS::Rss::Channel::Cloud
- RSS::Rss::Channel::Image
- RSS::Rss::Channel::Item::Category
- RSS::Rss::Channel::Item::Enclosure
- RSS::Rss::Channel::Item::Guid
- RSS::Rss::Channel::Item::Source
- RSS::Rss::Channel::SkipDays
- RSS::Rss::Channel::SkipDays::Day
- RSS::Rss::Channel::SkipHours
- RSS::Rss::Channel::SkipHours::Hour
- RSS::Rss::Channel::TextInput
- RSS::SetupMaker
- RSS::SlashModel
- RSS::SyndicationModel
- RSS::TaxonomyTopicModel
- RSS::TaxonomyTopicModel::TaxonomyTopic
- RSS::TaxonomyTopicsModel
- RSS::TaxonomyTopicsModel::TaxonomyTopics
- RSS::TaxonomyTopicsModel::TaxonomyTopics::Bag
- RSS::TooMuchTagError
- RSS::UnknownConversionMethodError
- RSS::UnknownTagError
- RSS::UnsupportedMakerVersionError
- RSS::Utils
- RSS::Utils::CSV
- RSS::Utils::InheritedReader
- RSS::Utils::YesCleanOther
- RSS::Utils::YesOther
- RSS::XML
- RSS::XML::Element
- RSS::XMLParserListener
- RSS::XMLParserNotFound
- RSS::XMLParserParser
- RSS::XMLScanListener
- RSS::XMLScanParser
- RSS::XMLStyleSheet
- RSS::XMLStyleSheetMixin
- Time
- XML
- XML::Parser
- XMLEncoding_ja
- XMLEncoding_ja::SJISHandler

No matching classes.

# RSS::ITunesItemModel::ITunesDuration

### Attributes

hour[R]
minute[R]
second[R]

### Public Class Methods

construct(hour, minute, second) click to toggle source

                   # File rss/itunes.rb, line 296
    def construct(hour, minute, second)
      components = [minute, second]
      if components.include?(nil)
        nil
      else
        components.unshift(hour) if hour and hour > 0
        components.collect do |component|
          "%02d" % component
        end.join(":")
      end
    end

new(*args) click to toggle source

                   # File rss/itunes.rb, line 314
    def initialize(*args)
      if Utils.element_initialize_arguments?(args)
        super
      else
        super()
        args = args[0] if args.size == 1 and args[0].is_a?(Array)
        if args.size == 1
          self.content = args[0]
        elsif args.size > 3
          raise ArgumentError,
                  "must be (do_validate, params), (content), " +
                  "(minute, second), ([minute, second]), "  +
                  "(hour, minute, second) or ([hour, minute, second]): " +
                  args.inspect
        else
          @second, @minute, @hour = args.reverse
          update_content
        end
      end
    end

parse(duration, do_validate=true) click to toggle source

                   # File rss/itunes.rb, line 276
    def parse(duration, do_validate=true)
      if do_validate and /\A(?:
                              \d?\d:[0-5]\d:[0-5]\d|
                              [0-5]?\d:[0-5]\d
                            )\z/x !~ duration
        raise ArgumentError,
                "must be one of HH:MM:SS, H:MM:SS, MM::SS, M:SS: " +
                duration.inspect
      end

      components = duration.split(':')
      components[3..-1] = nil if components.size > 3

      components.unshift("00") until components.size == 3

      components.collect do |component|
        component.to_i
      end
    end

required_prefix() click to toggle source

                   # File rss/itunes.rb, line 268
    def required_prefix
      ITUNES_PREFIX
    end

required_uri() click to toggle source

                   # File rss/itunes.rb, line 272
    def required_uri
      ITUNES_URI
    end

### Public Instance Methods

content=(value) click to toggle source

                   # File rss/itunes.rb, line 335
    def content=(value)
      if value.nil?
        @content = nil
      elsif value.is_a?(self.class)
        self.content = value.content
      else
        begin
          @hour, @minute, @second = self.class.parse(value, @do_validate)
        rescue ArgumentError
          raise NotAvailableValueError.new(tag_name, value)
        end
        @content = value
      end
    end

Also aliased as: value=
full_name() click to toggle source

                   # File rss/itunes.rb, line 369
    def full_name
      tag_name_with_prefix(ITUNES_PREFIX)
    end

hour=(hour) click to toggle source

                   # File rss/itunes.rb, line 351
    def hour=(hour)
      @hour = @do_validate ? Integer(hour) : hour.to_i
      update_content
      hour
    end

minute=(minute) click to toggle source

                   # File rss/itunes.rb, line 357
    def minute=(minute)
      @minute = @do_validate ? Integer(minute) : minute.to_i
      update_content
      minute
    end

second=(second) click to toggle source

                   # File rss/itunes.rb, line 363
    def second=(second)
      @second = @do_validate ? Integer(second) : second.to_i
      update_content
      second
    end

value=(value) click to toggle source
Alias for: content=