Skip to content

Commit 88c3804

Browse files
2243 yard doc (#2247)
* Added yard doc for internet * Fixed yard doc * Added yard doc for lorem * Added missing yard doc
1 parent 664cbaf commit 88c3804

21 files changed

+579
-57
lines changed

lib/faker/default/app.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ def author
6363
#
6464
# @faker.version 1.4.3
6565
def semantic_version(legacy_major = NOT_GIVEN, legacy_minor = NOT_GIVEN, legacy_patch = NOT_GIVEN, major: 0..9, minor: 0..9, patch: 1..9)
66-
# rubocop:enable Metrics/ParameterLists
6766
warn_for_deprecated_arguments do |keywords|
6867
keywords << :major if legacy_major != NOT_GIVEN
6968
keywords << :minor if legacy_minor != NOT_GIVEN
@@ -72,6 +71,7 @@ def semantic_version(legacy_major = NOT_GIVEN, legacy_minor = NOT_GIVEN, legacy_
7271

7372
[major, minor, patch].map { |chunk| sample(Array(chunk)) }.join('.')
7473
end
74+
# rubocop:enable Metrics/ParameterLists
7575
end
7676
end
7777
end

lib/faker/default/avatar.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ class << self
3939
#
4040
# @faker.version 1.4.3
4141
def image(legacy_slug = NOT_GIVEN, legacy_size = NOT_GIVEN, legacy_format = NOT_GIVEN, legacy_set = NOT_GIVEN, legacy_bgset = NOT_GIVEN, slug: nil, size: '300x300', format: 'png', set: 'set1', bgset: nil)
42-
# rubocop:enable Metrics/ParameterLists
4342
warn_for_deprecated_arguments do |keywords|
4443
keywords << :slug if legacy_slug != NOT_GIVEN
4544
keywords << :size if legacy_size != NOT_GIVEN
@@ -55,6 +54,7 @@ def image(legacy_slug = NOT_GIVEN, legacy_size = NOT_GIVEN, legacy_format = NOT_
5554
bgset_query = "&bgset=#{bgset}" if bgset
5655
"https://robohash.org/#{slug}.#{format}?size=#{size}&set=#{set}#{bgset_query}"
5756
end
57+
# rubocop:enable Metrics/ParameterLists
5858
end
5959
end
6060
end

lib/faker/default/barcode.rb

+22-11
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
module Faker
44
class Barcode < Base
55
class << self
6-
## Returns a EAN 8 or 13 digit format barcode number with check digit
6+
##
7+
# Returns a EAN 8 or 13 digit format barcode number with check digit
78
# @return [String]
89
#
910
# @example
@@ -16,7 +17,8 @@ def ean(length = 8)
1617
generate_barcode("barcode.ean_#{Integer(length)}")
1718
end
1819

19-
## Returns a EAN 8 or 13 digit format barcode number with composite string attached with check digit
20+
##
21+
# Returns a EAN 8 or 13 digit format barcode number with composite string attached with check digit
2022
# @return [String]
2123
#
2224
# @example
@@ -29,7 +31,8 @@ def ean_with_composite_symbology(length = 8)
2931
"#{ean(length)}|#{bothify(parse('barcode.composite_symbol'))}"
3032
end
3133

32-
## Returns a UPC_A format barcode number with check digit
34+
##
35+
# Returns a UPC_A format barcode number with check digit
3336
# @return [String]
3437
#
3538
# @example
@@ -40,7 +43,8 @@ def upc_a
4043
generate_barcode('barcode.upc_a')
4144
end
4245

43-
## Returns a UPC_E format barcode number with check digit
46+
##
47+
# Returns a UPC_E format barcode number with check digit
4448
# @return [String]
4549
#
4650
# @example
@@ -51,7 +55,8 @@ def upc_e
5155
generate_barcode('barcode.upc_e')
5256
end
5357

54-
## Returns a UPC_A format barcode number with composite string attached with check digit
58+
##
59+
# Returns a UPC_A format barcode number with composite string attached with check digit
5560
# @return [String]
5661
#
5762
# @example
@@ -62,7 +67,8 @@ def upc_a_with_composite_symbology
6267
"#{upc_a}|#{bothify(parse('barcode.composite_symbol'))}"
6368
end
6469

65-
## Returns a UPC_E format barcode number with composite string attached with check digit
70+
##
71+
# Returns a UPC_E format barcode number with composite string attached with check digit
6672
# @return [String]
6773
#
6874
# @example
@@ -73,7 +79,8 @@ def upc_e_with_composite_symbology
7379
"#{upc_e}|#{bothify(parse('barcode.composite_symbol'))}"
7480
end
7581

76-
## Returns a ISBN format barcode number with check digit
82+
##
83+
# Returns a ISBN format barcode number with check digit
7784
# @return [String]
7885
#
7986
# @example
@@ -84,7 +91,8 @@ def isbn
8491
generate_barcode('barcode.isbn')
8592
end
8693

87-
## Returns a ISMN format barcode number with check digit
94+
##
95+
# Returns a ISMN format barcode number with check digit
8896
# @return [String]
8997
#
9098
# @example
@@ -95,7 +103,8 @@ def ismn
95103
generate_barcode('barcode.ismn')
96104
end
97105

98-
## Returns a ISSN format barcode number with check digit
106+
##
107+
# Returns a ISSN format barcode number with check digit
99108
# @return [String]
100109
#
101110
# @example
@@ -114,7 +123,8 @@ def generate_barcode(key)
114123
"#{barcode}#{check_digit}"
115124
end
116125

117-
## Returns the sum of even and odd numbers from value passed
126+
##
127+
# Returns the sum of even and odd numbers from value passed
118128
#
119129
# @return [Array]
120130
#
@@ -137,7 +147,8 @@ def sum_even_odd(fake_num)
137147
[sum_odd, sum_even]
138148
end
139149

140-
## Generates the check digits from sum passed
150+
##
151+
# Generates the check digits from sum passed
141152
#
142153
# @return [Integer]
143154
#

lib/faker/default/cannabis.rb

+10
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
module Faker
44
class Cannabis < Base
5+
##
56
# Produces a random strain.
67
#
78
# @return [String]
@@ -14,6 +15,7 @@ def self.strain
1415
fetch('cannabis.strains')
1516
end
1617

18+
##
1719
# Produces a random abbreviation.
1820
#
1921
# @return [String]
@@ -26,6 +28,7 @@ def self.cannabinoid_abbreviation
2628
fetch('cannabis.cannabinoid_abbreviations')
2729
end
2830

31+
##
2932
# Produces a random cannabinoid type.
3033
#
3134
# @return [String]
@@ -38,6 +41,7 @@ def self.cannabinoid
3841
fetch('cannabis.cannabinoids')
3942
end
4043

44+
##
4145
# Produces a random terpene type.
4246
#
4347
# @return [String]
@@ -50,6 +54,7 @@ def self.terpene
5054
fetch('cannabis.terpenes')
5155
end
5256

57+
##
5358
# Produces a random kind of medical use.
5459
#
5560
# @return [String]
@@ -62,6 +67,7 @@ def self.medical_use
6267
fetch('cannabis.medical_uses')
6368
end
6469

70+
##
6571
# Produces a random health benefit.
6672
#
6773
# @return [String]
@@ -74,6 +80,7 @@ def self.health_benefit
7480
fetch('cannabis.health_benefits')
7581
end
7682

83+
##
7784
# Produces a random category.
7885
#
7986
# @return [String]
@@ -86,6 +93,7 @@ def self.category
8693
fetch('cannabis.categories')
8794
end
8895

96+
##
8997
# Produces a random type.
9098
#
9199
# @return [String]
@@ -98,6 +106,7 @@ def self.type
98106
fetch('cannabis.types')
99107
end
100108

109+
##
101110
# Produces a random buzzword.
102111
#
103112
# @return [String]
@@ -110,6 +119,7 @@ def self.buzzword
110119
fetch('cannabis.buzzwords')
111120
end
112121

122+
##
113123
# Produces a random brand.
114124
#
115125
# @return [String]

lib/faker/default/chuck_norris.rb

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ class ChuckNorris < Base
55
flexible :chuck_norris
66

77
class << self
8+
##
89
# Produces a Chuck Norris Fact.
910
# Original list of facts:
1011
# https://github.com/jenkinsci/chucknorris-plugin/blob/master/src/main/java/hudson/plugins/chucknorris/FactGenerator.java

lib/faker/default/code.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,11 @@ def rut
8080
value << "-#{vd}"
8181
end
8282

83+
##
84+
# Produces a random NRIC (National Registry Identity Card) code.
8385
# By default generates a Singaporean NRIC ID for someone
8486
# who is born between the age of 18 and 65.
8587
#
86-
# Produces a random NRIC (National Registry Identity Card) code.
87-
#
8888
# @param min_age [Integer] the min age of the person in years
8989
# @param max_age [Integer] the max age of the person in years
9090
# @return [String]

lib/faker/default/company.rb

+18
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,18 @@ def brazilian_company_number(legacy_formatted = NOT_GIVEN, formatted: false)
404404
formatted ? format('%s.%s.%s/%s-%s', *number.scan(/(\d{2})(\d{3})(\d{3})(\d{4})(\d{2})/).flatten) : number
405405
end
406406

407+
##
407408
# Get a random Russian tax number.
409+
# @param region [String] Any region string
410+
# @param type [Symbol] Legeal or not, defaults to :legal
411+
#
412+
# @return [String]
413+
# @example
414+
# Faker::Company.russian_tax_number #=> "0415584064"
415+
# Faker::Company.russian_tax_number(region: 'AZ') #=> "AZ50124562"
416+
# Faker::Company.russian_tax_number(region: 'AZ', type: false) #=> "AZ8802315465"
417+
#
418+
# @faker.version 1.9.4
408419
def russian_tax_number(region: nil, type: :legal)
409420
inn_number(region, type)
410421
end
@@ -507,7 +518,14 @@ def weight_sum(array, weights)
507518
#
508519
# Range of regions:
509520
# https://ru.wikipedia.org/wiki/Коды_субъектов_Российской_Федерации
521+
# region [String] Any region string
522+
# @param type [Symbol] Legeal or not, defaults to :legal
510523
#
524+
# @return [String]
525+
# @example
526+
# Faker::Comnpany.russian_tax_number
527+
# Faker::Comnpany.russian_tax_number(region: 'AZ')
528+
# Faker::Comnpany.russian_tax_number(region: 'AZ', type: false)
511529
# rubocop:enable Style/AsciiComments
512530
def inn_number(region, type)
513531
n10 = [2, 4, 10, 3, 5, 9, 4, 6, 8]

lib/faker/default/driving_licence.rb

+3-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ class DrivingLicence < Base
66
NI_CHANCE = 0.03 # NI Pop is about 3% of total UK population
77

88
class << self
9+
# rubocop:disable Metrics/ParameterLists
10+
911
##
1012
# Produces a random British driving licence number.
1113
#
@@ -23,9 +25,7 @@ class << self
2325
# date_of_birth: Date.parse("1986-10-24")) #=> "OCARR815246J91HT"
2426
#
2527
# @faker.version 1.9.2
26-
# rubocop:disable Metrics/ParameterLists
2728
def british_driving_licence(legacy_last_name = NOT_GIVEN, legacy_initials = NOT_GIVEN, legacy_gender = NOT_GIVEN, legacy_date_of_birth = NOT_GIVEN, last_name: Faker::Name.last_name, initials: Faker::Name.initials, gender: random_gender, date_of_birth: Faker::Date.birthday(min_age: 18, max_age: 65))
28-
# rubocop:enable Metrics/ParameterLists
2929
warn_for_deprecated_arguments do |keywords|
3030
keywords << :last_name if legacy_last_name != NOT_GIVEN
3131
keywords << :initials if legacy_initials != NOT_GIVEN
@@ -40,6 +40,7 @@ def british_driving_licence(legacy_last_name = NOT_GIVEN, legacy_initials = NOT_
4040
gb_licence_checksum
4141
].join
4242
end
43+
# rubocop:enable Metrics/ParameterLists
4344

4445
##
4546
# Produces a random Northern Irish licence number.

lib/faker/default/file.rb

+6-4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
module Faker
44
class File < Base
55
class << self
6+
# rubocop:disable Metrics/ParameterLists
7+
68
##
79
# Produces a random directory name.
810
#
@@ -18,9 +20,7 @@ class << self
1820
# Faker::File.dir(segment_count: 3, root: nil, directory_separator: '\\') #=> "aut-ullam\\quia_quisquam\\ut-eos"
1921
#
2022
# @faker.version 1.6.4
21-
# rubocop:disable Metrics/ParameterLists
2223
def dir(legacy_segment_count = NOT_GIVEN, legacy_root = NOT_GIVEN, legacy_directory_separator = NOT_GIVEN, segment_count: 3, root: nil, directory_separator: ::File::Separator)
23-
# rubocop:enable Metrics/ParameterLists
2424
warn_for_deprecated_arguments do |keywords|
2525
keywords << :segment_count if legacy_segment_count != NOT_GIVEN
2626
keywords << :root if legacy_root != NOT_GIVEN
@@ -34,6 +34,7 @@ def dir(legacy_segment_count = NOT_GIVEN, legacy_root = NOT_GIVEN, legacy_direct
3434
.join(directory_separator)
3535
.squeeze(directory_separator)
3636
end
37+
# rubocop:enable Metrics/ParameterLists
3738

3839
##
3940
# Produces a random file extension.
@@ -61,6 +62,8 @@ def mime_type
6162
fetch('file.mime_type')
6263
end
6364

65+
# rubocop:disable Metrics/ParameterLists
66+
6467
##
6568
# Produces a random file name.
6669
#
@@ -77,9 +80,7 @@ def mime_type
7780
# Faker::File.file_name(dir: 'foo/bar', name: 'baz', ext: 'mp3', directory_separator: '\\') #=> "foo/bar\\baz.mp3"
7881
#
7982
# @faker.version 1.6.4
80-
# rubocop:disable Metrics/ParameterLists
8183
def file_name(legacy_dir = NOT_GIVEN, legacy_name = NOT_GIVEN, legacy_ext = NOT_GIVEN, legacy_directory_separator = NOT_GIVEN, dir: nil, name: nil, ext: nil, directory_separator: ::File::Separator)
82-
# rubocop:enable Metrics/ParameterLists
8384
warn_for_deprecated_arguments do |keywords|
8485
keywords << :dir if legacy_dir != NOT_GIVEN
8586
keywords << :name if legacy_name != NOT_GIVEN
@@ -93,6 +94,7 @@ def file_name(legacy_dir = NOT_GIVEN, legacy_name = NOT_GIVEN, legacy_ext = NOT_
9394

9495
[dir, name].join(directory_separator) + ".#{ext}"
9596
end
97+
# rubocop:enable Metrics/ParameterLists
9698
end
9799
end
98100
end

0 commit comments

Comments
 (0)