Sha256: c218790e8e0e2586ca4b23b8adc50f8953a5c8a892b0886657a8c6d9f56e4c31
Contents?: true
Size: 1.44 KB
Versions: 1
Compression:
Stored size: 1.44 KB
Contents
h1. partial-date * "Homepage":https://github.com/58bits/partial-date#readme * "Issues":https://github.com/58bits/partial-date/issues * "Documentation":http://rubydoc.info/gems/partial-date/frames h2. Description A simple date class that can be used to store partial date values in a single column/attribute. An example use case would include an archive, or catalogue entry where the complete date is unknown. h2. Features PartialDate::Date uses an 8 digit integer to store year, month and day values. Values for month and day are optional. h2. Examples bc.. require 'partial-date' # Default initializer date = PartialDate::Date.new # => date.value # => 0 # Initialize from a block of integers date = PartialDate::Date.new {|d| d.year = 2012, d.month = 01} # => 2012-01 date.value # => 20120100 # Initialize from a block of strings date = PartialDate::Date.new {|d| d.year = "2012", d.month = "01"} # => 2012-01 date.value # => 20120100 # Initialize from the class load method - for rehydrating a date instance from a stored integer date value. date = PartialDate::Date.load 20121201 # => 2012-12-01 date.year # => 2012 date.month # => 12 date.day # => 1 h2. Install @$ gem install partial-date@ h2. TODO # @PartialDate::Date.parse@ method for construction from strings. # A Hash or Array backing store for date components for better performance. # Include Comparable h2. Copyright Copyright (c) 2012 Anthony Bouch See {file:LICENSE.txt} for details.
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
partial-date-1.0.0 | README.textile |