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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8144307e042b9d7f78554129aec5a0e669867c98
4
- data.tar.gz: 6824499bee409cf9ff9ffdcaa7548ccc577b16c2
3
+ metadata.gz: f3f6d88aeaa7a900ae27273230c3bc060abde486
4
+ data.tar.gz: 25dd7917d92db592e9f48d24e62bb77b367cff87
5
5
  SHA512:
6
- metadata.gz: 47831e8296e50923b5e6c9d13b48dbb04dc16feaf5c36fa85ea34ba16425fb7700e902f0ee26806ae2228d2a5b6042aa4e93c93fa2346b9eca63855661e79a26
7
- data.tar.gz: 6fb5065a976b6b1e87077e58bdc869c46d1bb7f21d699ab52307b2b141f4f93fc44a4d198d0ceeb3e5831cc5d921eef2c8a23f75c61e2a52b205c4c1326b49d6
6
+ metadata.gz: 1cd70a2bbfa22c652093112ac6141955dce3d88e2791e6f100aec8df71762d681a56c564b529420f26ade64f9f095016917ee1e8fdbb368a24e207a24755795e
7
+ data.tar.gz: 43b29b1e33975fd1c014b1dbd1fd458362e17183d60846ec5356e9c7d9eed0d72433bc4a6cc23561114ce5e47784a59d9c567c2ae6d915cedd6475469f7348a2
@@ -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 { |weekday| Time::WEEKDAYS.include?(weekday) }
13
- .map { |weekday| Time::WEEKDAYS.index(weekday) }
12
+ .select(&Time::WEEKDAYS.method(:include?))
13
+ .map(&Time::WEEKDAYS.method(:index))
14
14
  .to_set
15
15
  end
16
16
 
@@ -1,5 +1,5 @@
1
1
  module Clavius
2
2
 
3
- VERSION = '0.1.0'
3
+ VERSION = '1.0.0'
4
4
 
5
5
  end
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: 0.1.0
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 00:00:00.000000000 Z
11
+ date: 2015-03-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: memoizable