clavius 0.1.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/clavius.rb +27 -0
- data/lib/clavius/configuration.rb +3 -3
- data/lib/clavius/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f3f6d88aeaa7a900ae27273230c3bc060abde486
|
4
|
+
data.tar.gz: 25dd7917d92db592e9f48d24e62bb77b367cff87
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1cd70a2bbfa22c652093112ac6141955dce3d88e2791e6f100aec8df71762d681a56c564b529420f26ade64f9f095016917ee1e8fdbb368a24e207a24755795e
|
7
|
+
data.tar.gz: 43b29b1e33975fd1c014b1dbd1fd458362e17183d60846ec5356e9c7d9eed0d72433bc4a6cc23561114ce5e47784a59d9c567c2ae6d915cedd6475469f7348a2
|
data/lib/clavius.rb
CHANGED
@@ -4,6 +4,33 @@ require 'forwardable'
|
|
4
4
|
require 'memoizable'
|
5
5
|
|
6
6
|
module Clavius
|
7
|
+
class << self
|
8
|
+
|
9
|
+
extend Forwardable
|
10
|
+
|
11
|
+
def configure(&block)
|
12
|
+
Thread.current[:clavius_schedule] = Schedule.new(&block)
|
13
|
+
end
|
14
|
+
|
15
|
+
delegate %i[
|
16
|
+
weekdays
|
17
|
+
included
|
18
|
+
excluded
|
19
|
+
before
|
20
|
+
after
|
21
|
+
active?
|
22
|
+
days
|
23
|
+
between
|
24
|
+
] => :schedule
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def schedule
|
29
|
+
Thread.current[:clavius_schedule] or
|
30
|
+
fail 'Clavius has not been configured.'
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
7
34
|
end
|
8
35
|
|
9
36
|
require 'clavius/calculation'
|
@@ -4,13 +4,13 @@ module Clavius
|
|
4
4
|
include Memoizable
|
5
5
|
|
6
6
|
def initialize
|
7
|
-
@raw = Raw.new.tap do |raw| yield raw end
|
7
|
+
@raw = Raw.new.tap do |raw| yield raw if block_given? end
|
8
8
|
end
|
9
9
|
|
10
10
|
def weekdays
|
11
11
|
raw.weekdays
|
12
|
-
.select
|
13
|
-
.map
|
12
|
+
.select(&Time::WEEKDAYS.method(:include?))
|
13
|
+
.map(&Time::WEEKDAYS.method(:index))
|
14
14
|
.to_set
|
15
15
|
end
|
16
16
|
|
data/lib/clavius/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clavius
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Craig Little
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: memoizable
|