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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5371cbcfcbeded441d2c2e3e8f633c2fd868d183
4
- data.tar.gz: 72304a021dfef130d32785f4d2bcd68989e0851e
3
+ metadata.gz: d341e7c30a7da55a96ae31a6312dc3aa0d8870a8
4
+ data.tar.gz: 5fdc3d52b49f83cbb6b2857b4b92fca1785e0984
5
5
  SHA512:
6
- metadata.gz: 7dafa990dfe100980190e75609c3fdae56a2110f22c536a9fb408f26094b1f61093cb8c64c0d9ee31683f8cb5b68c5605c10afc96b72b2e065bef9cce8250a58
7
- data.tar.gz: c168f8e4f414fc3457b9b42135a12f32ace970875ee97dc0c6d169446705c4224426f25e9c230cff8bb0f936f3a52dd9f26e38701afb68a1c540d76e4def15f2
6
+ metadata.gz: dfbce184b7c997dfb249523dd9444b84fc27954dbd37ac77bd4e11099c91827801561473c161cbf1202dd98f54d848ab77d48d363aaacf7e03e186f892fbed12
7
+ data.tar.gz: 14c41468341715c5e9162f017eb0bc548b782081f51fd54545e58e57b1cc9b166ea6b2f992346c145afc78f912a04c421b585eebb25512cee4881a50fe57e00e
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- business-period (0.0.3)
4
+ business-period (0.0.5)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -2,7 +2,7 @@
2
2
 
3
3
  require 'yaml'
4
4
 
5
- require 'business_period/configuration'
5
+ require 'business_period/config'
6
6
  require 'business_period/version'
7
7
  require 'business_period/base'
8
8
  require 'business_period/days'
@@ -3,7 +3,7 @@
3
3
  module BusinessPeriod
4
4
  class Base
5
5
  def config
6
- @config ||= BusinessPeriod.configuration
6
+ @config ||= Config
7
7
  end
8
8
 
9
9
  # Returns range of days
@@ -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
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BusinessPeriod
4
- VERSION = '0.0.4'
4
+ VERSION = '0.0.5'
5
5
  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
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-01 00:00:00.000000000 Z
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/configuration.rb
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