sane_week 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/lib/sane_week.rb +21 -0
- metadata +44 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 322473f71c1129434f2af43e5cd3ce8d235a72f9
|
|
4
|
+
data.tar.gz: 10fa427f10b64ba6c1b414b4df27eceb4affe935
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: f4c113fe836365bf4e3a8d3b14358122a04eafaf8ce3d4ffc0596d6edefcd953c65b725589735eb33ebc7b3a2839fdaca2e05c1b554e7e3968baea2c8c223cea
|
|
7
|
+
data.tar.gz: b1770175f7505938084b7fb06c2a3a9d174c42d050d63fd71d8a9c244808d5e3bd08bb7f61981a5b7b4128fd4427a7df812d580568a2db07a828042190d74db8
|
data/lib/sane_week.rb
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
require 'Date'
|
|
2
|
+
|
|
3
|
+
class Week
|
|
4
|
+
# starts on a monday
|
|
5
|
+
attr_accessor :start_date, :monday, :tuesday, :wednesday, :thursday, :friday, :saturday, :sunday
|
|
6
|
+
|
|
7
|
+
def initialize(date = Date.today)
|
|
8
|
+
@start_date = find_monday(date)
|
|
9
|
+
process_days
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def find_monday date
|
|
13
|
+
date.monday? ? date : find_monday(date - 1)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def process_days
|
|
17
|
+
days = {:monday => 0, :tuesday => 1, :wednesday => 2, :thursday => 3, :friday => 4, :saturday => 5, :sunday => 6}
|
|
18
|
+
days.each { |day, val| instance_variable_set("@#{day}", @start_date + val ) }
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: sane_week
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Blaed Johnston
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2014-10-09 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description: A simple gem for weeks starting on monday
|
|
14
|
+
email: blaedj@gmail.com
|
|
15
|
+
executables: []
|
|
16
|
+
extensions: []
|
|
17
|
+
extra_rdoc_files: []
|
|
18
|
+
files:
|
|
19
|
+
- lib/sane_week.rb
|
|
20
|
+
homepage: http://github.com/blaedj/week
|
|
21
|
+
licenses:
|
|
22
|
+
- MIT
|
|
23
|
+
metadata: {}
|
|
24
|
+
post_install_message:
|
|
25
|
+
rdoc_options: []
|
|
26
|
+
require_paths:
|
|
27
|
+
- lib
|
|
28
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - ">="
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '0'
|
|
33
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
34
|
+
requirements:
|
|
35
|
+
- - ">="
|
|
36
|
+
- !ruby/object:Gem::Version
|
|
37
|
+
version: '0'
|
|
38
|
+
requirements: []
|
|
39
|
+
rubyforge_project:
|
|
40
|
+
rubygems_version: 2.4.2
|
|
41
|
+
signing_key:
|
|
42
|
+
specification_version: 4
|
|
43
|
+
summary: weeks starting on mondays
|
|
44
|
+
test_files: []
|