Sha256: b90be31b9dc9ec56d93ba30e9708446756218207384916c2095775fd1cc6d508

Contents?: true

Size: 863 Bytes

Versions: 1

Compression:

Stored size: 863 Bytes

Contents

= SixArm.com » Ruby » Week model based on Ruby Date

Author:: Joel Parker Henderson, joel@joelparkerhenderson.com
Copyright:: Copyright (c) 2006-2012 Joel Parker Henderson
License:: See LICENSE.txt file

This gem models a week, based on the built-in Ruby Date class.

== Examples


Initialize:
    
    date = Date.parse('2012-01-02')
    week = Week.new(date)
    week.to_s => '2012-01-02'

Parse:

    week = Week.parse('2012-01-02')
    week => 2012-01-02

Enumerable:

    week.previous => 2011-12-26
    week.next => 2012-01-16

Math:

    week - 3 => 2011-12-12
    week + 3 => 2012-01-24

Start & End Dates:

    week.start_date => 2012-01-02
    week.end_date => 2012-01-08

Range:

    week.date_range => Range(2012-01-02..2012-01-08)

Collection:

    date = Date.parse('2012-01-02')
    week.include?(date) => true
    week.include?(date+7) => false

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sixarm_ruby_week-1.1.4 README.rdoc