From bd6bde4fc5603a04624106df406bca79f6e98292 Mon Sep 17 00:00:00 2001 From: danielTiringer Date: Wed, 17 Jun 2020 18:32:53 +0200 Subject: [PATCH 1/2] Update docs for Faker::Date with separate examples --- doc/default/date.md | 8 ++++++-- lib/faker/default/date.rb | 16 ++++++++++------ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/doc/default/date.md b/doc/default/date.md index 980e40aa54..4c85b5a5b1 100644 --- a/doc/default/date.md +++ b/doc/default/date.md @@ -3,11 +3,15 @@ ```ruby # Random date between dates # Keyword arguments: from, to -Faker::Date.between(from: 2.days.ago, to: Date.today) #=> "Wed, 24 Sep 2014" +Faker::Date.between(from: '2014-09-23', to: '2014-09-25') #=> # +# If used with Rails (the Activesupport gem), additional options are available: +Faker::Date.between(from: 2.days.ago, to: Date.today) #=> # # Random date between dates except for certain date # Keyword arguments: from, to, excepted -Faker::Date.between_except(from: 1.year.ago, to: 1.year.from_now, excepted: Date.today) #=> "Wed, 24 Sep 2014" +Faker::Date.between_except(from: '2014-09-23', to: '2015-09-25', excepted: '2015-01-24') #=> # +# If used with Rails (the Activesupport gem), additional options are available: +Faker::Date.between_except(from: 1.year.ago, to: 1.year.from_now, excepted: Date.today) #=> # # Random date in the future (up to maximum of N days) # Keyword arguments: days diff --git a/lib/faker/default/date.rb b/lib/faker/default/date.rb index 966ce22d13..b30e01e168 100644 --- a/lib/faker/default/date.rb +++ b/lib/faker/default/date.rb @@ -10,9 +10,11 @@ class << self # @param to [Date, String] The end of the usable date range. # @return [Date] # - # @example - # Faker::Date.between(from: 2.days.ago, to: Date.today) - # #=> # + # @example if used with or without Rails (Activesupport) + # Faker::Date.between(from: '2014-09-23', to: '2014-09-25') #=> # + # + # @example if used with Rails (Activesupport) + # Faker::Date.between(from: 2.days.ago, to: Date.today) #=> # # # @faker.version 1.0.0 def between(legacy_from = NOT_GIVEN, legacy_to = NOT_GIVEN, from:, to:) @@ -37,9 +39,11 @@ def between(legacy_from = NOT_GIVEN, legacy_to = NOT_GIVEN, from:, to:) # @param excepted [Date, String] A date to exclude. # @return [Date] # - # @example - # Faker::Date.between_except(from: 1.year.ago, to: 1.year.from_now, excepted: Date.today) - # #=> # + # @example if used with or without Rails (Activesupport) + # Faker::Date.between_except(from: '2014-09-23', to: '2015-09-25', excepted: '2015-01-24') #=> # + # + # @example if used with Rails (Activesupport) + # Faker::Date.between_except(from: 1.year.ago, to: 1.year.from_now, excepted: Date.today) #=> # # # @faker.version 1.6.2 def between_except(legacy_from = NOT_GIVEN, legacy_to = NOT_GIVEN, legacy_excepted = NOT_GIVEN, from:, to:, excepted:) From 4c3ff0cf58655c2676a68ca96a212deab673511a Mon Sep 17 00:00:00 2001 From: danielTiringer Date: Thu, 18 Jun 2020 06:06:48 +0200 Subject: [PATCH 2/2] Correct Active Support spelling --- doc/default/date.md | 4 ++-- lib/faker/default/date.rb | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/default/date.md b/doc/default/date.md index 4c85b5a5b1..858fb2193e 100644 --- a/doc/default/date.md +++ b/doc/default/date.md @@ -4,13 +4,13 @@ # Random date between dates # Keyword arguments: from, to Faker::Date.between(from: '2014-09-23', to: '2014-09-25') #=> # -# If used with Rails (the Activesupport gem), additional options are available: +# If used with Rails (the Active Support gem), additional options are available: Faker::Date.between(from: 2.days.ago, to: Date.today) #=> # # Random date between dates except for certain date # Keyword arguments: from, to, excepted Faker::Date.between_except(from: '2014-09-23', to: '2015-09-25', excepted: '2015-01-24') #=> # -# If used with Rails (the Activesupport gem), additional options are available: +# If used with Rails (the Active Support gem), additional options are available: Faker::Date.between_except(from: 1.year.ago, to: 1.year.from_now, excepted: Date.today) #=> # # Random date in the future (up to maximum of N days) diff --git a/lib/faker/default/date.rb b/lib/faker/default/date.rb index b30e01e168..2b9d88a113 100644 --- a/lib/faker/default/date.rb +++ b/lib/faker/default/date.rb @@ -10,10 +10,10 @@ class << self # @param to [Date, String] The end of the usable date range. # @return [Date] # - # @example if used with or without Rails (Activesupport) + # @example if used with or without Rails (Active Support) # Faker::Date.between(from: '2014-09-23', to: '2014-09-25') #=> # # - # @example if used with Rails (Activesupport) + # @example if used with Rails (Active Support) # Faker::Date.between(from: 2.days.ago, to: Date.today) #=> # # # @faker.version 1.0.0 @@ -39,10 +39,10 @@ def between(legacy_from = NOT_GIVEN, legacy_to = NOT_GIVEN, from:, to:) # @param excepted [Date, String] A date to exclude. # @return [Date] # - # @example if used with or without Rails (Activesupport) + # @example if used with or without Rails (Active Support) # Faker::Date.between_except(from: '2014-09-23', to: '2015-09-25', excepted: '2015-01-24') #=> # # - # @example if used with Rails (Activesupport) + # @example if used with Rails (Active Support) # Faker::Date.between_except(from: 1.year.ago, to: 1.year.from_now, excepted: Date.today) #=> # # # @faker.version 1.6.2