workpattern 0.3.4 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 369fff3d813c83a9202c4593c93222f0683a3bc5
4
- data.tar.gz: e8c724250a725fecffbea9232e14e70422339e39
2
+ SHA256:
3
+ metadata.gz: 32e6c1903732854fa9a9ae45a5c02ebb408391ce931e2b8b20b9c7f3f349bae0
4
+ data.tar.gz: 1a99b95b71dda679fe674a7ff83595cac0922afb39b1012cc0239aafbf57c486
5
5
  SHA512:
6
- metadata.gz: ecf42d51cce8b9f68f29c0ba7009f88450fb510f028b7e246f5fa144c72cb1369e79e7502f021e2a09a49de2bfd637d8cf42aa4a10902427de808186f3079c8b
7
- data.tar.gz: bad7c4fdfe5e04b9804742197ebdc91147130ce687b3b3558056c6736ddf70631ffdcb1d1a7e70fe7c36e670002f5883985f5290d87fef5392680fc423efe183
6
+ metadata.gz: 5c19219fa8b5f49ecb48e8072bc92143f688f4e2ed3edf32a11415e3d7e3b886e29d222818309ca2df570f95be68ed4d9c341d01fc43548b8302faa6a1a30052
7
+ data.tar.gz: 0247b415ada6052c16041a4ed18f3cbe28bc6af1d2dae3bc11f625fd50a77ca912ef52df46b98a3bb44858e6e50ec1a34799096821806de939e79e8c36765b4d
data/.gitignore CHANGED
@@ -1,4 +1,8 @@
1
- doc
2
- pkg
3
- .yardoc
4
- ./Gemfile.lock
1
+ /.bundle/
2
+ /.yardoc/
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
data/.travis.yml CHANGED
@@ -1,5 +1,20 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 1.9.3
4
- - jruby-19mode # JRuby in 1.9 mode
5
- - 2.0.0
3
+ - 1.9.3
4
+ - 2.1
5
+ - 2.2
6
+ - 2.3
7
+ - 2.4
8
+ - 2.5
9
+ - 2.6
10
+ - ruby-head
11
+ - jruby-19mode
12
+ - jruby-head
13
+ deploy:
14
+ provider: rubygems
15
+ api_key:
16
+ secure: IXKBqbRf+2aDOpH+g0LpTtIzyagDqjHy6Bo/UYtLqR42CHZUnzre8AvCTvobB+BlHF9W+Igdaf3tzzY+A+XrTf38Iut+zsFI6KnkP7pN8pSMfcpuxZrLi0vd24QAHlHLCHIwsl4WfHj/swIRQGtlhvAV5mcTLW2rhE9/M6pGvRo=
17
+ gem: workpattern
18
+ on:
19
+ tags: true
20
+ repo: callenb/workpattern
data/CHANGELOG.md ADDED
@@ -0,0 +1,88 @@
1
+ ## Workpattern v0.6.0 ( 25 Feb, 2021) ##
2
+
3
+ I stopped keeping this Changelog file update back when v0.5.0 was realeased on 19 Oct 2016 and now it is 10Feb 2021 and I'm playing catch-up.
4
+ I have created the following set of bullet point changes by going through my commit messages, the quality of which varies greatly.
5
+ A lot of the effort has been on making the code easier to read as it was a real mess.
6
+ Here is a chronological take on what I have been doing.
7
+
8
+ * removed test warnings by surrounding ambiguous negatives with parenthesis
9
+ * I think a bug was fixed by changing #wee_total and #total to just an attr_writer
10
+ * removed some duplicated code
11
+ * replaced a number of literals with constants which I put in their own file
12
+ * made a lot of the code easier to read, such as extracting to a method with a sensible name or renaming existing ones
13
+ * Workpattern is now tested on Ruby 1.9.3, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, ruby-head, jruby-19mode & jruby-head
14
+ * Created a Day class to remove the complexity from Week so Week deals with weeks and Day with a day
15
+ * My Clock class was replaced by Time or Date objects in all tests. Clock only used for internal stuff now.
16
+ * Switched to sorted_set rubygem after the SortedSet class was removed from Ruby in v3.x.
17
+ * Workpattern now works with ruby 3.0.1dev
18
+ * added Contributor Covenant Code of Conduct
19
+
20
+ ## Workpattern v0.5.0 ( Oct 19, 2016) ##
21
+
22
+ * Workpattern now handles Timezones. It changes the date into UTC, does the calculation and then changes it back * Barrie Callender
23
+ * Removed Day class and associated tests as it is no longer used * Barrie Callender
24
+ * Reviewed the README and removed a lot of cruft and also updated it a little to demonstrate features * Barrie Callender
25
+ * Hid documentation unless it was part of the public api * Barrie Callender
26
+ * Used Rubocop to help me be more consistent. I ignored some of the offences to do with long lines/methods and classes * Barrie Callender
27
+ * Code makes use of Time objects where it use to use DateTime. Time comes with a Timezone * Barrie Callender
28
+ * Rewrote/refactored methods in the Week class - which needs refactoring into new classes * Barrie Callender
29
+ * Removed rubyforge_project from workpattern.gemspec * Barrie Callender
30
+ * Added homepage & required_ruby_version to workpattern.gemspec * Barrie Callender
31
+ * Added versions to test in Travis CI to include 1.9.3, 2.0.0, 2.1.0, 2.1.9, 2.2.0, 2.2.5, 2.3.0 & 2.3.1 * Barrie Callender
32
+ * Dealt with Travis CI issue with version of bundler * Barrie Callender
33
+ * Removed config directory & contents * Barrie Callender
34
+ * Changed Description * barrie Callender
35
+ * Specified minitest ~> 5.4.3 due to an issue I no longer recall * Barrie Callender
36
+ * Hid all the documentation apart from public api * Barrie Callender
37
+ * improved the README.md (IMHO) * Barrie Callender
38
+
39
+ ## Workpattern v0.4.0 ( May 23, 2014) ##
40
+
41
+ * Updated Week class to use bits and removed Day and Hour class as a consequence * Barrie Callender *
42
+ * This resulted in a performance improvement and some new tests
43
+
44
+ ## Workpattern v0.3.6 (Mar 25, 2014) ##
45
+
46
+ * total minutes of week is zero when short week starting after Sunday (#17) * Barrie Callender *
47
+ * Subtracting starting from top of the hour and last minute is non working (#18) * Barrie Callender *
48
+ * Refactorings intended to make the code easier to read and easier to change - still more to do * Barrie Callender *
49
+
50
+ ## Workpattern v0.3.5 (Sep 30, 2013) ##
51
+
52
+ * License missing from gemspec (#16) * Barrie Callender *
53
+ * Removed Gemfile.lock from git and updated .gitignore to the bundler defaults * Barrie Callender *
54
+
55
+ ## Workpattern v0.3.4 (Sep 27, 2013) ##
56
+
57
+ * diff doesn't calculate properly from working to resting day (#15) * Barrie Callender *
58
+
59
+ ## Workpattern v0.3.3 (Sep 23, 2013) ##
60
+
61
+ * Failed to subtract 1 minute from end of resting hour (#12) * Barrie Callender *
62
+ * Failed to add minutes starting from a resting period in a patterned hour (#13) * Barrie Callender *
63
+ * Failed to subtract the exact amount of minutes from a patterned hour (#14) * Barrie Callender *
64
+ * The two tests no longer fail with Ruby 2.0 (#11) * Barrie Callender *
65
+
66
+
67
+ ## Workpattern v0.3.2 (Mar 14, 2013) ##
68
+
69
+ * Changed methods on Hour module so as to not clash with Rails (#10) * Barrie Callender *
70
+ * Applied DRY principle to workpattern method in Workpattern class * Barrie Callender *
71
+ * Removed file from emacs backup * Barrie Callender *
72
+
73
+ ## Workpattern v0.3.1 (Oct 14, 2012) ##
74
+
75
+ * RDOC documentation not right on rubydoc.info (#5) * Barrie Callender *
76
+
77
+ ## Workpattern v0.3.0 (Jul 19, 2012) ##
78
+
79
+ * incomplete tests for week (#2) * Barrie Callender *
80
+ * getting wrong time when hour had exactly the right number of minutes (#9) * Barrie Callender *
81
+ * jruby-19mode failed with SystemStackError: stack level too deep (#8) * Barrie Callender *
82
+ * midnight flag should override hour and minutes (#7) * Barrie Callender *
83
+ * available minutes not calculating correctly for a time of 00:01 (#6) * Barrie Callender *
84
+
85
+ ## Workpattern v0.2.0 (May 31, 2012) ##
86
+
87
+ * Rewritten from scratch effectively first version * Barrie Callender *
88
+ * Please discard any version of Workpattern before this - some poor souls may have come across v0.1.0. - sorry! * Barrie Callender *
@@ -0,0 +1,84 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or
22
+ advances of any kind
23
+ * Trolling, insulting or derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information, such as a physical or email
26
+ address, without their explicit permission
27
+ * Other conduct which could reasonably be considered inappropriate in a
28
+ professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
+
34
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
+
36
+ ## Scope
37
+
38
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
+
40
+ ## Enforcement
41
+
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at barrie@callenb.org. All complaints will be reviewed and investigated promptly and fairly.
43
+
44
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
+
46
+ ## Enforcement Guidelines
47
+
48
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
+
50
+ ### 1. Correction
51
+
52
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
+
54
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
+
56
+ ### 2. Warning
57
+
58
+ **Community Impact**: A violation through a single incident or series of actions.
59
+
60
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
+
62
+ ### 3. Temporary Ban
63
+
64
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
+
66
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
+
68
+ ### 4. Permanent Ban
69
+
70
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
+
72
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
73
+
74
+ ## Attribution
75
+
76
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
+ available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
+
79
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
+
81
+ [homepage]: https://www.contributor-covenant.org
82
+
83
+ For answers to common questions about this code of conduct, see the FAQ at
84
+ https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
data/Gemfile CHANGED
@@ -2,3 +2,7 @@ source "http://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in workpattern.gemspec
4
4
  gemspec
5
+
6
+ gem "rake", "~> 13.0"
7
+
8
+ gem "minitest", "~> 5.0"
data/Gemfile.lock CHANGED
@@ -1,16 +1,31 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- workpattern (0.3.3)
4
+ workpattern (0.6.0)
5
+ sorted_set
6
+ tzinfo
5
7
 
6
8
  GEM
7
9
  remote: http://rubygems.org/
8
10
  specs:
9
- rake (0.9.6)
11
+ concurrent-ruby (1.1.8)
12
+ minitest (5.14.4)
13
+ rake (13.0.3)
14
+ rbtree (0.4.4)
15
+ set (1.0.1)
16
+ sorted_set (1.0.3)
17
+ rbtree
18
+ set (~> 1.0)
19
+ tzinfo (2.0.4)
20
+ concurrent-ruby (~> 1.0)
10
21
 
11
22
  PLATFORMS
12
- ruby
23
+ x86_64-linux
13
24
 
14
25
  DEPENDENCIES
15
- rake (~> 0.9.2)
26
+ minitest (~> 5.0)
27
+ rake (~> 13.0)
16
28
  workpattern!
29
+
30
+ BUNDLED WITH
31
+ 2.2.9
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021 Barrie Callender
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md CHANGED
@@ -1,118 +1,94 @@
1
1
  # Workpattern [![Build Status](https://secure.travis-ci.org/callenb/workpattern.png)](https://secure.travis-ci.org/callenb/workpattern.png)
2
2
 
3
- ## What?
3
+ Calculates dates and durations whilst taking into account working and non-working times. It creates calendars similar to what you can find in project scheduling software like Microsoft project and Primavera P6.
4
4
 
5
- Simple addition and subtraction of minutes on dates taking account of real-life working and resting periods.
5
+ Please use [Github Issues] to report bugs. If you have a question about the library, please use the `workpattern` tag on [Stack Overflow]. This tag is monitored by contributors.
6
6
 
7
- ## So What?
7
+ [Github Issues]: http://github.com/callenb/workpattern/issues
8
+ [Stack Overflow]: http://stackoverflow.com/questions/tagged/workpattern
8
9
 
9
- The core Ruby classes that represent date and time allow calculations by adding a duration such as days or
10
- minutes to a date and returning the new `Date` or `DateTime` as the result. Although there
11
- are 60 seconds in every minute and 60 minutes in every hour, there aren't always 24 hours in every day, and
12
- if there was, we still wouldn't be working during all of them. We would be doing other things like eating,
13
- sleeping, travelling and having a bit of leisure time. Workpattern refers to this time as Resting time.
14
- It refers to the time when we're busy doing stuff as Working time.
10
+ ## Getting Started
15
11
 
16
- When it comes to scheduling work, whether part of a project, teachers in a classroom or even bed availability
17
- in a hospital, the working day can have anything from 0 hours to the full 24 hours. Most office based work
18
- is something like 7.5 or 8 hours a day except weekends, public holidays and vacations when no work takes
19
- place.
12
+ Workpattern is a library with no monkey-patching and was tested using [Travis](https://travis-ci.org) against the following Ruby versions `1.9.3`, `2.1`, `2.2`, `2.3`, `2.4`, `2.5`, `2.6`, `ruby-head (3.1.0dev)`, `jruby-19mode (9.2.9.0 (2.5.7)` and `jruby-head (9.3.0.0-SNAPSHOT (2.6.5)`.
20
13
 
21
- The `Workpattern` library was born to allow date related calculations to take into account real life
22
- working and resting times. It gets told about working and resting periods and can then perform calculations
23
- on a given date. It can add and subtract a number of minutes, calculate the working minutes between two dates
24
- and say whether a specific minute is working or resting.
14
+ You can install it using:
15
+ ```sh
16
+ gem install workpattern
17
+ ```
25
18
 
26
- This gem has the potential to serve as the engine for scheduling algorithms that are the core of products such as Microsoft Project and Oracle Primavera P6 as well as other applications that need to know when they can perform work and when they can’t.
19
+ Or you can add it to your Gemfile with:
27
20
 
28
- ## Install
21
+ ```sh
22
+ gem "workpattern"
23
+ ```
29
24
 
30
- `sudo gem install workpattern`
25
+ Then run the bundle command to install it.
31
26
 
32
- ## Getting Started
27
+ ## Use
28
+
29
+ ## Configure and Calculate
33
30
 
34
- The first step is to create a `Workpattern` to hold all the working and resting times. I'll start in 2011 and let it run for 10 years.
31
+ First create a `Workpattern` to hold all the working and resting times.
35
32
 
36
33
  ``` ruby
37
- mywp=Workpattern.new('My Workpattern',2011,10)
34
+ mywp=Workpattern.new 'My Workpattern',2011,10
38
35
  ```
36
+ That line created a `Workpattern` called `My Workpattern` starting on 1-Jan-2011 and continuing for `10` years until `2020`.
39
37
 
40
- My `Workpattern` will be created as a 24 hour a day full working time. Now it has to be told about the resting periods. First the weekends.
38
+ `mywp` is created with a 24 hour a day working time. Next step is to tell it to ignore weekends by making every Saturday and Sunday non-working.
41
39
 
42
40
  ``` ruby
43
- mywp.resting(:days => :weekend)
41
+ mywp.resting :days => :weekend
44
42
  ```
45
43
 
46
- then the days in the week have specific working and resting times using the *Workpattern.clock* method, although anything that responds to `#hour` and `#min` methods will do ...
44
+ The `Workpattern.clock` method can be used to specify the non-working times for each weekday. Any class that responds to `#hour` and `#min` methods such as `Time` or `DateTime` can be used instead of `Workpattern.clock`.
47
45
 
48
46
  ``` ruby
49
- mywp.resting(:days =>:weekday, :from_time=>Workpattern.clock(0,0),:to_time=>Workpattern.clock(8,59))
50
- mywp.resting(:days =>:weekday, :from_time=>Workpattern.clock(12,0),:to_time=>Workpattern.clock(12,59))
51
- mywp.resting(:days =>:weekday, :from_time=>Workpattern.clock(18,0),:to_time=>Workpattern.clock(23,59))
47
+ mywp.resting :days =>:weekday, :from_time=>Workpattern.clock(0,0),:to_time=>Workpattern.clock(8,59)
48
+ mywp.resting :days =>:weekday, :from_time=>Workpattern.clock(12,0),:to_time=>Workpattern.clock(12,59)
49
+ mywp.resting :days =>:weekday, :from_time=>Workpattern.clock(18,0),:to_time=>Workpattern.clock(23,59)
52
50
  ```
51
+ As well as `:weekend` and `:weekday` it is possible to use `:mon`, `:tue`, `:wed`, `:thu`, `:fri`, `:sat`, `:sun` or `all`.
53
52
 
54
- Now we have the working and resting periods setup we can just add 32 hours as minutes (1920) to our date.
53
+ With `mywp` setup, the `#calc` method is used to add 32 hours which must be supplied as the number of whole minutes (1920) to a date.
55
54
 
56
55
  ``` ruby
57
- mydate=DateTime.civil(2011,9,1,9,0)
58
- result_date = mywp.calc(mydate,1920) # => 6/9/11@18:00
56
+ my_date=Time.gm 2011,9,1,9,0
57
+ result_date = mywp.calc my_date,1920 # => 6/9/11@18:00
59
58
  ```
60
59
 
61
- ## Development
62
-
63
- * Source hosted on [GitHub](http://github.com/callenb/workpattern).
64
- * Direct questions and discussions to the [mailing list](http://groups.google.com/group/workpattern).
65
- * Report issues on [GitHub Issues](http://github.com/callenb/workpattern/issues).
66
- * Pull requests are very welcome, however I have never participated in Open Source so will be a bit slow as I am learning. Please be patient with me. Please include spec and/or feature coverage for every patch, and create a topic branch for every separate change you make.
67
- * Advice, such as pointing out how I should really code in Ruby will be gratefully received.
68
-
69
- ## Things To Do
70
-
71
- In its current form this library is being made available to see if there is any interest in using
72
- it. At the moment it can perform the following:
73
-
74
- * define the working and resting minutes for any 24 hour day
75
- * given a date it can return the resulting date after adding or subtracting a number of minutes
76
- * calculate the number of working minutes between two dates
77
- * report whether a specific minute in time is working or resting
60
+ The result takes into account the non-working or resting times.
78
61
 
79
- This is what I consider to be the basics, but there are a number of functional and non-functial areas I
80
- would like to address in a future version.
62
+ Subtracting a date is just as easy by using a negative number of minutes in `#calc`.
81
63
 
82
- ## Functional
64
+ Finding the duration between two dates is also easy using the `#diff` method.
83
65
 
84
- * Merge two Workpatterns together to create a new one allowing either resting or working to take precedence
85
- * Given a date, find the next working or resting minute either before or after it.
86
- * Handle both 23 and 25 hour days that occur when the clocks change.
87
- * Extract patterns from the workpattern so they can be persisted in a database.
88
- * Decide how to handle different Timezones apart from UTC.
89
-
90
- ## Non-Functional
66
+ ``` ruby
67
+ diff_result = mywp.diff my_date, result_date # => 1920
68
+ ```
91
69
 
92
- * Improve the documentation and introduce real world use as an example
93
- * Improve my ability to write Ruby code
70
+ Vacations can be added to the `Workpattern` using the `#resting` method:
94
71
 
95
- ## License
72
+ ``` ruby
73
+ mywp.resting :days => :all, :start => DateTime.civil(2011,5,1), :finish => DateTime.civil(2011,5,7)
74
+ ```
75
+ Find out if a specific date and time is working or not.
96
76
 
97
- (The MIT License)
77
+ ``` ruby
78
+ mydate = DateTime.civil 2011,5,2,9,10
79
+ mywp.resting? mydate # => true
80
+ mywp.working? mydate # => false
81
+ ```
98
82
 
99
- Copyright (c) 2012
83
+ ### Manage
100
84
 
101
- Permission is hereby granted, free of charge, to any person obtaining
102
- a copy of this software and associated documentation files (the
103
- 'Software'), to deal in the Software without restriction, including
104
- without limitation the rights to use, copy, modify, merge, publish,
105
- distribute, sublicense, and/or sell copies of the Software, and to
106
- permit persons to whom the Software is furnished to do so, subject to
107
- the following conditions:
85
+ ``` ruby
86
+ # Fetch a specific Workpattern
87
+ Workpattern.get "My Workpattern"
108
88
 
109
- The above copyright notice and this permission notice shall be
110
- included in all copies or substantial portions of the Software.
89
+ # Delete a specific Workpattern
90
+ Workpattern.delete "My Workpattern"
111
91
 
112
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
113
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
114
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
115
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
116
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
117
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
118
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
92
+ # Delete all Workpatterns
93
+ Workpattern.clear
94
+ ```