Sha256: 91275b83f64b4e4e07c35abad925d3da8a45d4b4d49f68c935a302cd86be4a00

Contents?: true

Size: 359 Bytes

Versions: 6

Compression:

Stored size: 359 Bytes

Contents

# -*- coding: utf-8 -*-

# Cast a date to an id.
#
class Date

  # Cast me to a date id.
  #
  #    Date.today.to_date_id
  #    #=> "2000-12-31"
  #
  def to_date_id
    self.to_time.strftime("%Y-%m-%d")
  end

  # Cast me to a list of date ids.
  #
  #    Date.today.to_date_id
  #    #=> "2000-12-31"
  #
  def to_date_ids
    [self.to_date_id]
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
sixarm_ruby_to_id-2.0.0 lib/sixarm_ruby_to_id/date.rb
sixarm_ruby_to_id-1.1.3 lib/sixarm_ruby_to_id/date.rb
sixarm_ruby_to_id-1.1.2 lib/sixarm_ruby_to_id/date.rb
sixarm_ruby_to_id-1.1.1 lib/sixarm_ruby_to_id/date.rb
sixarm_ruby_to_id-1.1.0 lib/sixarm_ruby_to_id/date.rb
sixarm_ruby_to_id-1.0.9 lib/sixarm_ruby_to_id/date.rb