Sha256: 5d4e6a2f3d9eac2907c1f8b0effff33c2ccf74694c10ea97a470b719a555e028

Contents?: true

Size: 571 Bytes

Versions: 2

Compression:

Stored size: 571 Bytes

Contents

class Array
  #Filters elements, collecting those
  #whose times are before _time_
  def before time
    query_time = Time.parse(time)
    select {|t| t.arrival[:expected] <= query_time }
  end

  #Filters elements, collecting those
  #whose times are after _time_
  def after time
    query_time = Time.parse(time)
    select {|t| t.arrival[:expected] >= query_time }
  end

  # The 'in' is just sugar really, saving the 
  # programmer from doing a trivial computation 
  # over and over again in their code.
  def in time
    select { |t| t.due_in <= time }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ierail-0.4.1 lib/core_ext.rb
ierail-0.4.0 lib/core_ext.rb