lib/ess/ess.rb
##
# Returns all events starting after the time specified by the first
# parameter and before the time specified by the second parameter,
# which accept regular Time objects.
#
# === Parameters
#
# [start_time] will return only events starting after this moment
# [end_time] will return only events starting before this moment
#
# === Returns
#
# A list of hashes, sorted by event start time, each hash having
# two keys:
#
# [:time] start time of the event
# [:feed] feed describing the event
#
Returns all events starting after the time specified by the first
parameter and before the time specified by the second parameter,
which accept regular Time objects.

Parameters

[start_time] will return only events starting after this moment
[end_time] will return only events starting before this moment

Returns

A list of hashes, sorted by event start time, each hash having
two keys.

[:time] start time of the event
[:feed] feed describing the event
Returns all events starting after the time specified by the first parameter and before the time specified by the second parameter which accept regular Time objects . Parameters [ start_time ] will return only events starting after this moment [ end_time ] will return only events starting before this moment Returns A list of hashes sorted by event start time each hash having two keys . [ : time ] start time of the event [ : feed ] feed describing the event
def find_between start_time, end_time
      feeds = []
      channel.feed_list.each do |feed|
        feed.dates.item_list.each do |item|
          if item.type_attr == "standalone"
            feed_start_time = Time.parse(item.start.text!)
            if feed_start_time.between?(start_time, end_time)
              feeds << { :time => feed_start_time, :feed => feed }
            end
          elsif item.type_attr == "recurrent"
            moments = parse_recurrent_date_item(item, end_time, start_time)
            moments.each do |moment|
              if moment.between?(start_time, end_time)
                feeds << { :time => moment, :feed => feed }
              end
            end
          elsif item.type_attr == "permanent"
            start = Time.parse(item.start.text!)
            unless start > end_time
              if start > start_time
                feeds << { :time => start, :feed => feed }
              else
                feeds << { :time => start_time, :feed => feed }
              end
            end
          else
            raise DTD::InvalidValueError, "the \"#{item.type_attr}\" is not valid for a date item type attribute"
          end
        end
      end
      feeds.sort! { |x, y| x[:time] <=> y[:time] }
    end
def find_between start_time , end_time feeds = [ ] channel . feed_list . each do | feed | feed . dates . item_list . each do | item | if item . type_attr == "standalone" feed_start_time = Time . parse ( item . start . text! ) if feed_start_time . between? ( start_time , end_time ) feeds << { :time => feed_start_time , :feed => feed } end elsif item . type_attr == "recurrent" moments = parse_recurrent_date_item ( item , end_time , start_time ) moments . each do | moment | if moment . between? ( start_time , end_time ) feeds << { :time => moment , :feed => feed } end end elsif item . type_attr == "permanent" start = Time . parse ( item . start . text! ) unless start > end_time if start > start_time feeds << { :time => start , :feed => feed } else feeds << { :time => start_time , :feed => feed } end end else raise DTD :: InvalidValueError , "the \"#{item.type_attr}\" is not valid for a date item type attribute" end end end feeds . sort! { | x , y | x [ :time ] <=> y [ :time ] } end
Returns all events starting after the time specified by the first
parameter and before the time specified by the second parameter,
which accept regular Time objects.
Returns all events starting after the time specified by the first parameter and before the time specified by the second parameter which accept regular Time objects .
start_time
<not_specific>
end_time
<not_specific>