business-period 0.0.4 → 0.0.5
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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/business-period.rb +1 -1
- data/lib/business_period/base.rb +1 -1
- data/lib/business_period/config.rb +27 -0
- data/lib/business_period/days.rb +0 -7
- data/lib/business_period/version.rb +1 -1
- metadata +3 -3
- data/lib/business_period/configuration.rb +0 -17
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d341e7c30a7da55a96ae31a6312dc3aa0d8870a8
|
|
4
|
+
data.tar.gz: 5fdc3d52b49f83cbb6b2857b4b92fca1785e0984
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: dfbce184b7c997dfb249523dd9444b84fc27954dbd37ac77bd4e11099c91827801561473c161cbf1202dd98f54d848ab77d48d363aaacf7e03e186f892fbed12
|
|
7
|
+
data.tar.gz: 14c41468341715c5e9162f017eb0bc548b782081f51fd54545e58e57b1cc9b166ea6b2f992346c145afc78f912a04c421b585eebb25512cee4881a50fe57e00e
|
data/Gemfile.lock
CHANGED
data/lib/business-period.rb
CHANGED
data/lib/business_period/base.rb
CHANGED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'singleton'
|
|
4
|
+
|
|
5
|
+
module BusinessPeriod
|
|
6
|
+
class Config
|
|
7
|
+
include Singleton
|
|
8
|
+
|
|
9
|
+
attr_accessor :locale, :work_days
|
|
10
|
+
|
|
11
|
+
def self.locale=(str)
|
|
12
|
+
instance.locale = str
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def self.locale
|
|
16
|
+
instance.locale.class == Proc ? instance.locale.call : instance.locale
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def self.work_days=(arr)
|
|
20
|
+
instance.work_days = arr
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def self.work_days
|
|
24
|
+
instance.work_days.class == Proc ? instance.work_days.call : instance.work_days
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
data/lib/business_period/days.rb
CHANGED
|
@@ -2,13 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
module BusinessPeriod
|
|
4
4
|
class Days < Base
|
|
5
|
-
def initialize(locale = nil, work_days = nil)
|
|
6
|
-
BusinessPeriod.configure do |config|
|
|
7
|
-
config.locale = locale if locale
|
|
8
|
-
config.work_days = work_days if work_days
|
|
9
|
-
end
|
|
10
|
-
end
|
|
11
|
-
|
|
12
5
|
def self.call(plot)
|
|
13
6
|
new.perform(plot)
|
|
14
7
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: business-period
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- matas
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2018-10-
|
|
11
|
+
date: 2018-10-02 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rspec
|
|
@@ -45,7 +45,7 @@ files:
|
|
|
45
45
|
- config/holidays/lt.yml
|
|
46
46
|
- lib/business-period.rb
|
|
47
47
|
- lib/business_period/base.rb
|
|
48
|
-
- lib/business_period/
|
|
48
|
+
- lib/business_period/config.rb
|
|
49
49
|
- lib/business_period/days.rb
|
|
50
50
|
- lib/business_period/version.rb
|
|
51
51
|
homepage: https://github.com/matass/business-period
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module BusinessPeriod
|
|
4
|
-
attr_accessor :configuration
|
|
5
|
-
|
|
6
|
-
def self.configuration
|
|
7
|
-
@configuration ||= Configuration.new
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
def self.configure
|
|
11
|
-
yield configuration
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
class Configuration
|
|
15
|
-
attr_accessor :locale, :work_days
|
|
16
|
-
end
|
|
17
|
-
end
|