Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add YARD docs for Faker:Verb #1916

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/faker/default/educator.rb
Expand Up @@ -5,6 +5,7 @@ class Educator < Base
flexible :educator

class << self
<<<<<<< HEAD
##
# Produces a university name.
#
Expand All @@ -14,6 +15,8 @@ class << self
# Faker::Educator.university #=> "Mallowtown Technical College"
#
# @faker.version 1.6.4
=======
>>>>>>> Deprecate warnings should be removed in v2
def university
parse('educator.university')
end
Expand Down
9 changes: 9 additions & 0 deletions lib/faker/default/number.rb
Expand Up @@ -3,6 +3,7 @@
module Faker
class Number < Base
class << self
<<<<<<< HEAD
##
# Produce a random number.
#
Expand All @@ -18,6 +19,11 @@ def number(legacy_digits = NOT_GIVEN, digits: 10)
keywords << :digits if legacy_digits != NOT_GIVEN
end

=======
extend Gem::Deprecate

def number(digits = 10)
>>>>>>> Deprecate Faker::Number.decimal_part and Faker::Number.leading_zero_number (#1516)
return if digits < 1
return rand(0..9).round if digits == 1

Expand Down Expand Up @@ -269,6 +275,9 @@ def should_be(number, method_to_compare)
number * -1
end
end

deprecate :decimal_part, nil, 2019, 06
deprecate :leading_zero_number, nil, 2019, 06
end
end
end
45 changes: 45 additions & 0 deletions lib/faker/default/verb.rb
Expand Up @@ -3,22 +3,67 @@
module Faker
class Verb < Base
class << self
##
# Produces the base form of a verb.
#
# @return [String]
#
# @example
# Faker::Verb.base #=> "shape"
#
# @faker.version 1.9.0
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I couldn't find mention of Faker::Verb in the change logs, I tested this by comparing git blame to release history and then loading versions around that time to see when it became available.

Is this a good way to determine the value for version, or is there a better way?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I usually just search for "Verb" in the GitHub repo and look for the earliest commit(s) mentioning it. You can see all the tags for the commit and the oldest one will be the first version it was included in.

def base
fetch('verbs.base')
end

##
# Produces the past form of a verb.
#
# @return [String]
#
# @example
# Faker::Verbs.past #=> "motivated"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Faker::Verbs.past #=> "motivated"
# Faker::Verb.past #=> "motivated"

#
# @faker.version 1.9.0
def past
fetch('verbs.past')
end

##
# Produces the past participle form of a verb.
#
# @return [String]
#
# @example
# Faker::Verbs.past_participle #=> "buzzed"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Faker::Verbs.past_participle #=> "buzzed"
# Faker::Verb.past_participle #=> "buzzed"

#
# @faker.version 1.9.0
def past_participle
fetch('verbs.past_participle')
end

##
# Produces the simple_present form of a verb.
#
# @return [String]
#
# @example
# Faker::Verbs.simple_present #=> "gets"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Faker::Verbs.simple_present #=> "gets"
# Faker::Verb.simple_present #=> "gets"

#
# @faker.version 1.9.0
def simple_present
fetch('verbs.simple_present')
end

##
# Produces the -ing form of a verb.
#
# @return [String]
#
# @example
# Faker::Verbs.ing_form #=> "climbing"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Faker::Verbs.ing_form #=> "climbing"
# Faker::Verb.ing_form #=> "climbing"

#
# @faker.version 1.9.0
def ing_form
fetch('verbs.ing_form')
end
Expand Down