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, generate, letterify, method_missing, numerify, parse, rand, rand_in_range, regexify, resolve, respond_to_missing?, sample, shuffle, shuffle!, translate, unique, with_locale

Class Method Details

.authorString

Produces the name of an app’s author.

Examples:

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

Returns:



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:



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

def name
  fetch('app.name')
end

.semantic_version(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:



63
64
65
# File 'lib/faker/default/app.rb', line 63

def semantic_version(major: 0..9, minor: 0..9, patch: 1..9)
  [major, minor, patch].map { |chunk| sample(Array(chunk)) }.join('.')
end

.versionString

Produces a version string.

Examples:

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

Returns:



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

def version
  parse('app.version')
end