Skip to content

Commit

Permalink
Add missing documentation to Faker::Computer (#2065)
Browse files Browse the repository at this point in the history
* Update computer version after publishing

* Add documentation page to Faker::Computer

* Correct the version number
  • Loading branch information
danielTiringer committed Jun 20, 2020
1 parent 24e937e commit ca6e689
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
17 changes: 17 additions & 0 deletions doc/default/computer.md
@@ -0,0 +1,17 @@
# Faker::Computer

Available since version 2.12.0.

```ruby
# A random computer platform
Faker::Computer.platform #=> "Linux"

# A random computer type
Faker::Computer.type #=> "server"

# A random computer OS
Faker::Computer.os #=> "RHEL 6.10"

# A random computer platform and OS combination.
Faker::Computer.stack #=> "Linux, RHEL 6.10"
```
8 changes: 4 additions & 4 deletions lib/faker/default/computer.rb
Expand Up @@ -11,7 +11,7 @@ class << self
# @example
# Faker::Computer.platform #=> "Linux"
#
# @faker.version next
# @faker.version 2.12.0
def platform
fetch('computer.platform')
end
Expand All @@ -24,7 +24,7 @@ def platform
# @example
# Faker::Computer.type #=> "server"
#
# @faker.version next
# @faker.version 2.12.0
def type
fetch('computer.type')
end
Expand All @@ -38,7 +38,7 @@ def type
# @example
# Faker::Computer.os #=> "RHEL 6.10"
#
# @faker.version next
# @faker.version 2.12.0
def os(platform: self.platform)
platform = self.platform unless fetch_all('computer.platform').include?(platform)
fetch("computer.os.#{platform.downcase}")
Expand All @@ -52,7 +52,7 @@ def os(platform: self.platform)
# @example
# Faker::Computer.stack #=> "Linux, RHEL 6.10"
#
# @faker.version next
# @faker.version 2.12.0
def stack
platform = self.platform
os = fetch("computer.os.#{platform.downcase}")
Expand Down

0 comments on commit ca6e689

Please sign in to comment.