faker 2.5.0 → 2.6.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
  SHA256:
3
- metadata.gz: f753c6745324477819be7fa8671395eaf8d64269de47b0aaa366ab3cb0b28655
4
- data.tar.gz: ccbb9fe077964f47444c76843548ff3c9272b321ec6e4c246ce66a2fe772bc7e
3
+ metadata.gz: 74df7e5e60856bfe1283a1e8de2b425e3b5617dfc9de2a05d651ab7ef69a35c0
4
+ data.tar.gz: 53b1457eb640182a15c4a34eb909aa252bd2f34b3990ef28ff2e8390b8417638
5
5
  SHA512:
6
- metadata.gz: a74a4e4fe1fdcafd4a09f379d3fd9955bb09c1a3bcc1ed8d996aec2d7fd7ec8cdbeb898ce536f9778dfdc55779c0b715bff3a8edd11545c5690e2a1f1e79e3b7
7
- data.tar.gz: f6ede2e9b87b99c453b79dad0d2ee57b0b542a72ab8efb166a8a4aeb3c5d6308285c6d6984787542660cfb8a0d99cf5f9419a7cfc6768f74a933ea9c7d63725f
6
+ metadata.gz: b5f3096b849d9aca43c94143b40411b52b29ea5c67468dd8a3f880d684ed7df02f4128281ffe36d8d144a3258324e64b3d7f3095177bee0cee066fa309beb14e
7
+ data.tar.gz: b303d58bc31496ad5913d273ab05b08b0dd8d45560725e15fd7c44200b0afb674671a2c70e3a291aad65a39367d3bd5b5ca63c206f219df8347fe260d0e41a4a
@@ -1,5 +1,29 @@
1
1
  # Change Log
2
2
 
3
+ ## [v2.6.0](https://github.com/faker-ruby/faker/tree/v2.6.0) (2019-10-10)
4
+
5
+ This version:
6
+ - adds `Faker::Date.in_date_period`
7
+ - adds `Faker::WorldCup` YARD docs
8
+ - updates local dependencies
9
+
10
+ ## Documentation
11
+
12
+ - [PR #1789](https://github.com/faker-ruby/faker/pull/1789) Faker::WorldCup YARD docs [@ashishra0](https://github.com/ashishra0)
13
+
14
+ ## Feature Request
15
+
16
+ - [PR #1755](https://github.com/faker-ruby/faker/pull/1755) Add Faker::Date.in_date_period [@AmrAdelKhalil](https://github.com/AmrAdelKhalil)
17
+
18
+ ## Update local dependencies
19
+
20
+ The following development dependencies were updated:
21
+ - Update rake requirement from = 12.3.3 to = 13.0.0 (#1776)
22
+ - Update minitest requirement from = 5.12.0 to = 5.12.2 (#1775)
23
+ - Update test-unit requirement from = 3.3.3 to = 3.3.4 (#1774)
24
+
25
+ ------------------------------------------------------------------------------
26
+
3
27
  ## [v2.5.0](https://github.com/faker-ruby/faker/tree/v2.5.0) (2019-30-09)
4
28
 
5
29
  This version introduces:
@@ -133,6 +133,30 @@ module Faker
133
133
  between(from: from, to: to).to_date
134
134
  end
135
135
 
136
+ ##
137
+ # Produces a date in the year and/or month specified.
138
+ #
139
+ # @param month [Integer] represents the month of the date
140
+ # @param year [Integer] represents the year of the date
141
+ # @return [Date]
142
+ #
143
+ # @example
144
+ # Faker::Date.in_date_period #=> #<Date: 2019-09-01>
145
+ #
146
+ # @example
147
+ # Faker::Date.in_date_period(year: 2018, month: 2) #=> #<Date: 2018-02-26>
148
+ #
149
+ # @example
150
+ # Faker::Date.in_date_period(month: 2) #=> #<Date: 2019-02-26>
151
+ #
152
+ # @faker.version next
153
+ def in_date_period(month: nil, year: ::Date.today.year)
154
+ from = ::Date.new(year, month || 1, 1)
155
+ to = ::Date.new(year, month || 12, ::Date.civil(year, month || 12, -1).day)
156
+
157
+ between(from: from, to: to).to_date
158
+ end
159
+
136
160
  private
137
161
 
138
162
  def birthday_date(date, age)
@@ -52,9 +52,9 @@ module Faker
52
52
  year = dob.year % 10
53
53
  month = gender == :female ? dob.month + 50 : dob.month
54
54
  # Rubocop's preferred formatting is pretty gory
55
- # rubocop:disable FormatString
55
+ # rubocop:disable Style/FormatString
56
56
  "#{decade}#{'%02d' % month}#{'%02d' % dob.day}#{year}"
57
- # rubocop:enable FormatString
57
+ # rubocop:enable Style/FormatString
58
58
  end
59
59
 
60
60
  def gb_licence_checksum
@@ -3,18 +3,56 @@
3
3
  module Faker
4
4
  class WorldCup < Base
5
5
  class << self
6
+ ##
7
+ # Produces a national team name.
8
+ #
9
+ # @return [String]
10
+ #
11
+ # @example
12
+ # Faker::WorldCup.team #=> "Iran"
13
+ #
14
+ # @faker.version 1.9.0
6
15
  def team
7
16
  fetch('world_cup.teams')
8
17
  end
9
18
 
19
+ ##
20
+ # Produces a city name hosting the World Cup match.
21
+ #
22
+ # @return [String]
23
+ #
24
+ # @example
25
+ # Faker::WorldCup.city #=> "Moscow"
26
+ #
27
+ # @faker.version next
10
28
  def city
11
29
  fetch('world_cup.cities')
12
30
  end
13
31
 
32
+ ##
33
+ # Produces the name of a stadium that has hosted a World Cup match.
34
+ #
35
+ # @return [String]
36
+ #
37
+ # @example
38
+ # Faker::WorldCup.stadium #=> "Rostov Arena"
39
+ #
40
+ # @faker.version next
14
41
  def stadium
15
42
  fetch('world_cup.stadiums')
16
43
  end
17
44
 
45
+ ##
46
+ # Produces a random national team name from a group. See below examples
47
+ #
48
+ # @return [String]
49
+ #
50
+ # @example
51
+ # Faker::WorldCup.group(group: 'group_B') #=> "Spain"
52
+ # @example
53
+ # Faker::WorldCup.group #=> "Russia"
54
+ #
55
+ # @faker.version next
18
56
  def group(legacy_group = NOT_GIVEN, group: 'group_A')
19
57
  warn_for_deprecated_arguments do |keywords|
20
58
  keywords << :group if legacy_group != NOT_GIVEN
@@ -23,6 +61,18 @@ module Faker
23
61
  fetch("world_cup.groups.#{group}")
24
62
  end
25
63
 
64
+ ##
65
+ # Produces a random name from national team roster. See below examples.
66
+ #
67
+ # @return [String]
68
+ #
69
+ # @example
70
+ # Faker::WorldCup.roster #=> "Hector Cuper"
71
+ #
72
+ # @example
73
+ # Faker::WorldCup.roster(country: 'Spain', type: 'forwards') #=> "Diego Costa"
74
+ #
75
+ # @faker.version next
26
76
  def roster(legacy_country = NOT_GIVEN, legacy_type = NOT_GIVEN, country: 'Egypt', type: 'coach')
27
77
  warn_for_deprecated_arguments do |keywords|
28
78
  keywords << :country if legacy_country != NOT_GIVEN
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Faker #:nodoc:
4
- VERSION = '2.5.0'
4
+ VERSION = '2.6.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: faker
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.0
4
+ version: 2.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benjamin Curtis
@@ -9,36 +9,42 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-09-30 00:00:00.000000000 Z
12
+ date: 2019-10-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: i18n
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - "~>"
18
+ - - ">="
19
19
  - !ruby/object:Gem::Version
20
- version: 1.6.0
20
+ version: '1.6'
21
+ - - "<"
22
+ - !ruby/object:Gem::Version
23
+ version: '1.8'
21
24
  type: :runtime
22
25
  prerelease: false
23
26
  version_requirements: !ruby/object:Gem::Requirement
24
27
  requirements:
25
- - - "~>"
28
+ - - ">="
29
+ - !ruby/object:Gem::Version
30
+ version: '1.6'
31
+ - - "<"
26
32
  - !ruby/object:Gem::Version
27
- version: 1.6.0
33
+ version: '1.8'
28
34
  - !ruby/object:Gem::Dependency
29
35
  name: minitest
30
36
  requirement: !ruby/object:Gem::Requirement
31
37
  requirements:
32
38
  - - '='
33
39
  - !ruby/object:Gem::Version
34
- version: 5.12.0
40
+ version: 5.12.2
35
41
  type: :development
36
42
  prerelease: false
37
43
  version_requirements: !ruby/object:Gem::Requirement
38
44
  requirements:
39
45
  - - '='
40
46
  - !ruby/object:Gem::Version
41
- version: 5.12.0
47
+ version: 5.12.2
42
48
  - !ruby/object:Gem::Dependency
43
49
  name: pry
44
50
  requirement: !ruby/object:Gem::Requirement
@@ -59,28 +65,28 @@ dependencies:
59
65
  requirements:
60
66
  - - '='
61
67
  - !ruby/object:Gem::Version
62
- version: 12.3.3
68
+ version: 13.0.0
63
69
  type: :development
64
70
  prerelease: false
65
71
  version_requirements: !ruby/object:Gem::Requirement
66
72
  requirements:
67
73
  - - '='
68
74
  - !ruby/object:Gem::Version
69
- version: 12.3.3
75
+ version: 13.0.0
70
76
  - !ruby/object:Gem::Dependency
71
77
  name: rubocop
72
78
  requirement: !ruby/object:Gem::Requirement
73
79
  requirements:
74
80
  - - '='
75
81
  - !ruby/object:Gem::Version
76
- version: 0.74.0
82
+ version: 0.75.0
77
83
  type: :development
78
84
  prerelease: false
79
85
  version_requirements: !ruby/object:Gem::Requirement
80
86
  requirements:
81
87
  - - '='
82
88
  - !ruby/object:Gem::Version
83
- version: 0.74.0
89
+ version: 0.75.0
84
90
  - !ruby/object:Gem::Dependency
85
91
  name: simplecov
86
92
  requirement: !ruby/object:Gem::Requirement
@@ -101,14 +107,14 @@ dependencies:
101
107
  requirements:
102
108
  - - '='
103
109
  - !ruby/object:Gem::Version
104
- version: 3.3.3
110
+ version: 3.3.4
105
111
  type: :development
106
112
  prerelease: false
107
113
  version_requirements: !ruby/object:Gem::Requirement
108
114
  requirements:
109
115
  - - '='
110
116
  - !ruby/object:Gem::Version
111
- version: 3.3.3
117
+ version: 3.3.4
112
118
  - !ruby/object:Gem::Dependency
113
119
  name: timecop
114
120
  requirement: !ruby/object:Gem::Requirement