Attributes
Read
No documentation available
Read
No documentation available
Read
No documentation available
Class Methods
lib/rss/itunes.rb
View on GitHub
# File tmp/rubies/ruby-2.7.6/lib/rss/itunes.rb, line 301
def construct(hours, minutes, seconds)
components = [minutes, seconds]
if components.include?(nil)
nil
else
components.unshift(hours) if hours and hours > 0
components.collect do |component|
"%02d" % component
end.join(':')
end
end
No documentation available
::
lib/rss/itunes.rb
View on GitHub
# File tmp/rubies/ruby-2.7.6/lib/rss/itunes.rb, line 327
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
No documentation available
lib/rss/itunes.rb
View on GitHub
# File tmp/rubies/ruby-2.7.6/lib/rss/itunes.rb, line 277
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|
\d+
)\z/x !~ duration
raise ArgumentError,
"must be one of HH:MM:SS, H:MM:SS, MM:SS, M:SS, S+: " +
duration.inspect
end
if duration.include?(':')
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
else
seconds_to_components(duration.to_i)
end
end
No documentation available
lib/rss/itunes.rb
View on GitHub
# File tmp/rubies/ruby-2.7.6/lib/rss/itunes.rb, line 269
def required_prefix
ITUNES_PREFIX
end
No documentation available
::
lib/rss/itunes.rb
View on GitHub
# File tmp/rubies/ruby-2.7.6/lib/rss/itunes.rb, line 273
def required_uri
ITUNES_URI
end
No documentation available
lib/rss/itunes.rb
View on GitHub
# File tmp/rubies/ruby-2.7.6/lib/rss/itunes.rb, line 314
def seconds_to_components(total_seconds)
hours = total_seconds / (60 * 60)
minutes = (total_seconds / 60) % 60
seconds = total_seconds % 60
[hours, minutes, seconds]
end
No documentation available
Instance Methods
lib/rss/itunes.rb
View on GitHub
# File tmp/rubies/ruby-2.7.6/lib/rss/itunes.rb, line 348
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
No documentation available
lib/rss/itunes.rb
View on GitHub
# File tmp/rubies/ruby-2.7.6/lib/rss/itunes.rb, line 382
def full_name
tag_name_with_prefix(ITUNES_PREFIX)
end
No documentation available
lib/rss/itunes.rb
View on GitHub
# File tmp/rubies/ruby-2.7.6/lib/rss/itunes.rb, line 364
def hour=(hour)
@hour = @do_validate ? Integer(hour) : hour.to_i
update_content
hour
end
No documentation available
lib/rss/itunes.rb
View on GitHub
# File tmp/rubies/ruby-2.7.6/lib/rss/itunes.rb, line 391
def maker_target(target)
if @content
target.itunes_duration {|duration| duration}
else
nil
end
end
No documentation available
lib/rss/itunes.rb
View on GitHub
# File tmp/rubies/ruby-2.7.6/lib/rss/itunes.rb, line 370
def minute=(minute)
@minute = @do_validate ? Integer(minute) : minute.to_i
update_content
minute
end
No documentation available
lib/rss/itunes.rb
View on GitHub
# File tmp/rubies/ruby-2.7.6/lib/rss/itunes.rb, line 376
def second=(second)
@second = @do_validate ? Integer(second) : second.to_i
update_content
second
end
No documentation available
lib/rss/itunes.rb
View on GitHub
# File tmp/rubies/ruby-2.7.6/lib/rss/itunes.rb, line 399
def setup_maker_element(duration)
super(duration)
duration.content = @content
end
No documentation available
lib/rss/itunes.rb
View on GitHub
# File tmp/rubies/ruby-2.7.6/lib/rss/itunes.rb, line 387
def update_content
@content = self.class.construct(hour, minute, second)
end
No documentation available