Class: Faker::App

Inherits:
Base
  • Object
show all
Defined in:
lib/faker/default/app.rb

Constant Summary

Constants inherited from Base

Base::LLetters, Base::Letters, Base::NOT_GIVEN, Base::Numbers, Base::ULetters

Class Method Summary collapse

Methods inherited from Base

bothify, disable_enforce_available_locales, fetch, fetch_all, flexible, letterify, method_missing, numerify, parse, rand, rand_in_range, regexify, resolve, respond_to_missing?, sample, shuffle, translate, unique, with_locale

Class Method Details

.authorString

Produces the name of an app's author.

Examples:

Faker::App.author #=> "Daphne Swift"

Returns:

  • (String)

Available since:

  • 1.4.3


41
42
43
# File 'lib/faker/default/app.rb', line 41

def author
  parse('app.author')
end

.nameString

Produces an app name.

Examples:

Faker::App.name #=> "Treeflex"

Returns:

  • (String)

Available since:

  • 1.4.3


15
16
17
# File 'lib/faker/default/app.rb', line 15

def name
  fetch('app.name')
end

.semantic_version(legacy_major = NOT_GIVEN, legacy_minor = NOT_GIVEN, legacy_patch = NOT_GIVEN, major: 0..9, minor: 0..9, patch: 1..9) ⇒ String

Produces a String representing a semantic version identifier.

Examples:

Faker::App.semantic_version #=> "3.2.5"
Faker::App.semantic_version(major: 42) #=> "42.5.2"
Faker::App.semantic_version(minor: 100..101) #=> "42.100.4"
Faker::App.semantic_version(patch: 5..6) #=> "7.2.6"

Parameters:

  • major (Integer, Range) (defaults to: 0..9)

    An integer to use or a range to pick the integer from.

  • minor (Integer, Range) (defaults to: 0..9)

    An integer to use or a range to pick the integer from.

  • patch (Integer, Range) (defaults to: 1..9)

    An integer to use or a range to pick the integer from.

Returns:

  • (String)

Available since:

  • 1.4.3


65
66
67
68
69
70
71
72
73
74
# File 'lib/faker/default/app.rb', line 65

def semantic_version(legacy_major = NOT_GIVEN, legacy_minor = NOT_GIVEN, legacy_patch = NOT_GIVEN, major: 0..9, minor: 0..9, patch: 1..9)
  # rubocop:enable Metrics/ParameterLists
  warn_for_deprecated_arguments do |keywords|
    keywords << :major if legacy_major != NOT_GIVEN
    keywords << :minor if legacy_minor != NOT_GIVEN
    keywords << :patch if legacy_patch != NOT_GIVEN
  end

  [major, minor, patch].map { |chunk| sample(Array(chunk)) }.join('.')
end

.versionString

Produces a version string.

Examples:

Faker::App.version #=> "1.85"

Returns:

  • (String)

Available since:

  • 1.4.3


28
29
30
# File 'lib/faker/default/app.rb', line 28

def version
  parse('app.version')
end