working_days 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.
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in working_days.gemspec
4
+ gemspec
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require 'bundler/gem_tasks'
@@ -0,0 +1,3 @@
1
+ module WorkingDays
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,19 @@
1
+ require "working_days/version"
2
+
3
+ module WorkingDays
4
+ def plus_working_days(number_of_days = 0)
5
+ res = self
6
+
7
+ number_of_days.times do |i|
8
+ res = res + 1.day
9
+
10
+ while [0,6].include?(res.wday) #or h = Holiday.find(:first, :conditions => ["start_date <= ? AND end_date >= ?", res.strftime('%Y-%m-%d'), res.strftime('%Y-%m-%d')])
11
+ res = res + 1.day
12
+ end
13
+ end
14
+
15
+ res
16
+ end
17
+ end
18
+
19
+ Time.send(:include, WorkingDays)
@@ -0,0 +1,20 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "working_days/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "working_days"
7
+ s.version = WorkingDays::VERSION
8
+ s.authors = ["Chiel Wester"]
9
+ s.email = ["chiel.wester@holder.nl"]
10
+ s.homepage = ""
11
+ s.summary = "Working days time extension"
12
+ s.description = "Add a number of working days to a Time object"
13
+
14
+ s.rubyforge_project = "working_days"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+ end
metadata ADDED
@@ -0,0 +1,62 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: working_days
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.0.1
6
+ platform: ruby
7
+ authors:
8
+ - Chiel Wester
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2011-10-17 00:00:00 +02:00
14
+ default_executable:
15
+ dependencies: []
16
+
17
+ description: Add a number of working days to a Time object
18
+ email:
19
+ - chiel.wester@holder.nl
20
+ executables: []
21
+
22
+ extensions: []
23
+
24
+ extra_rdoc_files: []
25
+
26
+ files:
27
+ - .gitignore
28
+ - Gemfile
29
+ - Rakefile
30
+ - lib/working_days.rb
31
+ - lib/working_days/version.rb
32
+ - working_days.gemspec
33
+ has_rdoc: true
34
+ homepage: ""
35
+ licenses: []
36
+
37
+ post_install_message:
38
+ rdoc_options: []
39
+
40
+ require_paths:
41
+ - lib
42
+ required_ruby_version: !ruby/object:Gem::Requirement
43
+ none: false
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: "0"
48
+ required_rubygems_version: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: "0"
54
+ requirements: []
55
+
56
+ rubyforge_project: working_days
57
+ rubygems_version: 1.6.2
58
+ signing_key:
59
+ specification_version: 3
60
+ summary: Working days time extension
61
+ test_files: []
62
+