payment_day 0.2.0 → 0.2.1

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
  SHA256:
3
- metadata.gz: 6e8eac69e44a25f3069daac105862597e6f763fbe4594828b5b5b1d6a500f5b5
4
- data.tar.gz: ca33ec1cb95f81285f18fdaf6d77dccc4d75ebc11b4fb62689d1c0f38e974393
3
+ metadata.gz: 473ff17dc41c8fe9778cb7f81ad6d5d563eb1ae8a62a83f6cc535e3b0dcd76d8
4
+ data.tar.gz: f8080f220c6816d42f7588ce612ce22948e0b678f0b54c2dcdace2f9051cb314
5
5
  SHA512:
6
- metadata.gz: 07f40ba0b61cebf07ca5f8a2430f059bf52b9af6182a4bb4f6c38f7d9045771645e01074faf1cbcc8072f9c12acae43398322b148b78662fe44ecab85056e412
7
- data.tar.gz: d4dd9e1c99c42e93197aeef849eb229c70fecb1ef3be93d09905af25667b648589af3ccf44c78b769e76bc733a1662ad69ef208d193b48c66bf107ac87a1aec1
6
+ metadata.gz: 336accb29ed0eaf542c978da383bb9233084071bb57fcd116e3ab573f62dc4e33c8283c1594835315c05d2bd87c9c0c082a98fc01e8503c9840524c279bcae25
7
+ data.tar.gz: 1b2a327752a17619233ad74985d9844b37da95aa8704bb838f5ae4a0a10a56832b441896dd703ccb20cc3a722c7b68016921308f957bb1f2280abd224884b2d8
data/README.md CHANGED
@@ -6,27 +6,27 @@ Provides a class PaymentDay::View. This class generates the pay days for the giv
6
6
 
7
7
  Install the gem and add to the application's Gemfile by executing:
8
8
 
9
- $ bundle add pay_day
9
+ $ bundle add payment_day
10
10
 
11
11
  If bundler is not being used to manage dependencies, install the gem by executing:
12
12
 
13
- $ gem install pay_day
13
+ $ gem install payment_day
14
14
 
15
15
  ## Usage
16
16
 
17
17
  ```ruby
18
18
  # Get the pay days
19
- PaymentDay::View(2023).pay_days # return Array of Hash(es) with the pay_days
20
- PaymentDay::View("2023").pay_days # accept String as input
21
- PaymentDay::View(2023, 2024).pay_days # accept multiple years
22
- PaymentDay::View([2023]).pay_days # accept Array's as input
23
- PaymentDay::View("2023-2024").pay_days # accept String ranges
24
- PaymentDay::View(2023..2024).pay_days # accept Range as input
25
- PaymentDay::View(2023..2024, 2025, '2026').pay_days # accept a mix of all of them
19
+ PaymentDay::View.create(2023).pay_days # return Array of Hash(es) with the pay_days
20
+ PaymentDay::View.create("2023").pay_days # accept String as input
21
+ PaymentDay::View.create(2023, 2024).pay_days # accept multiple years
22
+ PaymentDay::View.create([2023]).pay_days # accept Array's as input
23
+ PaymentDay::View.create("2023-2024").pay_days # accept String ranges
24
+ PaymentDay::View.create(2023..2024).pay_days # accept Range as input
25
+ PaymentDay::View.create(2023..2024, 2025, '2026').pay_days # accept a mix of all of them
26
26
 
27
27
  # Last parameter defines the options if set
28
28
  # shows 2023 twice in the list of pay_days, default is false
29
- PaymentDay::View(2023..2024, 2023, duplicates: true).pay_days
29
+ PaymentDay::View.create(2023..2024, 2023, duplicates: true).pay_days
30
30
 
31
31
  table = PaymentDay::View(2023).list # returns a Terminal::Table instance
32
32
  puts table # which can be printed like this
@@ -19,13 +19,13 @@ module PaymentDay
19
19
  method_option :header, aliases: "-h", type: :boolean, default: true, desc: "Do you wanna see the table title?"
20
20
  method_option :separator, aliases: "-s", type: :boolean, default: true, desc: "Do you want to have a separator for the rows printed?"
21
21
  def view(*years)
22
- years = PaymentDay::View.new(years, options).years
22
+ years = PaymentDay::View.create(years, options).years
23
23
  years = years.each_slice(options[:columns])
24
24
  years.each_with_index do |yearsChunk, page|
25
25
  year_options = options.dup
26
26
  year_options[:page] = page.next
27
27
  year_options[:pages] = years.to_a.length
28
- puts PaymentDay::View.new(yearsChunk, year_options).list()
28
+ puts PaymentDay::View.create(yearsChunk, year_options).list()
29
29
  end
30
30
  end
31
31
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PaymentDay
4
- VERSION = "0.2.0"
4
+ VERSION = "0.2.1"
5
5
  end
data/lib/payment_day.rb CHANGED
@@ -18,6 +18,8 @@ module PaymentDay
18
18
  separator: true
19
19
  }.freeze
20
20
 
21
+ private_class_method :new
22
+
21
23
  attr_reader :pay_days, :years
22
24
 
23
25
  def initialize(*years)
@@ -28,6 +30,10 @@ module PaymentDay
28
30
  @pay_days = find_pay_days
29
31
  end
30
32
 
33
+ def self.create(*years)
34
+ new(*years)
35
+ end
36
+
31
37
  def list
32
38
  Terminal::Table.new do |t|
33
39
  t.title = Rainbow("Pay days").bright
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: payment_day
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - PuLLi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-12-31 00:00:00.000000000 Z
11
+ date: 2023-01-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rainbow
@@ -64,7 +64,6 @@ extra_rdoc_files: []
64
64
  files:
65
65
  - CHANGELOG.md
66
66
  - Gemfile
67
- - Gemfile.lock
68
67
  - LICENSE.txt
69
68
  - README.md
70
69
  - Rakefile
data/Gemfile.lock DELETED
@@ -1,29 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- payment_day (0.1.2)
5
- rainbow (~> 3.1)
6
- terminal-table (~> 3.0)
7
- thor (~> 1.2)
8
-
9
- GEM
10
- remote: https://rubygems.org/
11
- specs:
12
- minitest (5.16.3)
13
- rainbow (3.1.1)
14
- rake (13.0.6)
15
- terminal-table (3.0.2)
16
- unicode-display_width (>= 1.1.1, < 3)
17
- thor (1.2.1)
18
- unicode-display_width (2.3.0)
19
-
20
- PLATFORMS
21
- arm64-darwin-22
22
-
23
- DEPENDENCIES
24
- minitest (~> 5.0)
25
- payment_day!
26
- rake (~> 13.0)
27
-
28
- BUNDLED WITH
29
- 2.4.1