From 20493d16feb979ff7fb4bb03ba455caf84942818 Mon Sep 17 00:00:00 2001 From: Matthew Clark Date: Thu, 25 Feb 2021 15:22:16 -0800 Subject: [PATCH 1/5] adds dwelling module and dwelling_type function --- lib/faker/dwelling.ex | 26 ++++++++++++++++++++++ lib/faker/dwelling/en.ex | 43 ++++++++++++++++++++++++++++++++++++ test/faker/dwelling_test.exs | 6 +++++ 3 files changed, 75 insertions(+) create mode 100644 lib/faker/dwelling.ex create mode 100644 lib/faker/dwelling/en.ex create mode 100644 test/faker/dwelling_test.exs diff --git a/lib/faker/dwelling.ex b/lib/faker/dwelling.ex new file mode 100644 index 000000000..7bfc2188f --- /dev/null +++ b/lib/faker/dwelling.ex @@ -0,0 +1,26 @@ +defmodule Faker.Dwelling do + import Faker, only: [localize: 1] + + + @moduledoc """ + Functions for generating Dwelling related data + """ + + @doc """ + Returns a dwelling type string + + ## Examples + iex> Faker.Dwelling.dwelling_type() + "Cycladic house" + iex> Faker.Dwelling.dwelling_type() + "Shepard's hut" + iex> Faker.Dwelling.dwelling_type() + "Cycladic house" + iex> Faker.Dwelling.dwelling_type() + "Earth house" + """ + + @spec dwelling_type :: String.t() + localize(:dwelling_type) + +end diff --git a/lib/faker/dwelling/en.ex b/lib/faker/dwelling/en.ex new file mode 100644 index 000000000..1222455ec --- /dev/null +++ b/lib/faker/dwelling/en.ex @@ -0,0 +1,43 @@ +defmodule Faker.Dwelling.En do + import Faker, only: [sampler: 2] + + @moduledoc """ + Functions for generating Dwelling related data in English + """ + + @doc """ + Returns a dwelling type string + + ## Examples + iex> Faker.Dwelling.dwelling_type() + "Cycladic house" + iex> Faker.Dwelling.dwelling_type() + "Shepard's hut" + iex> Faker.Dwelling.dwelling_type() + "Cycladic house" + iex> Faker.Dwelling.dwelling_type() + "Earth house" + """ + @spec dwelling_type() :: String.t() + sampler(:dwelling_type, [ + "Bungalow", + "Cabin", + "Casa Particular", + "Chalet", + "Cottage", + "Cycladic house", + "Dammuso", + "Dome house", + "Earth house", + "House", + "Houseboat", + "Hut", + "Lighthouse", + "Pension", + "Shepard's hut", + "Tiny house", + "Townhouse", + "Trulio", + "Villa", + ]) +end diff --git a/test/faker/dwelling_test.exs b/test/faker/dwelling_test.exs new file mode 100644 index 000000000..c215500cf --- /dev/null +++ b/test/faker/dwelling_test.exs @@ -0,0 +1,6 @@ +defmodule Faker.HomeTest do + use ExUnit.Case, async: true + + doctest Faker.Dwelling + doctest Faker.Dwelling.En +end From 98863d8fb16c3b0f8a1c5b3e1bc5cb95b13d3c6c Mon Sep 17 00:00:00 2001 From: Matthew Clark Date: Thu, 25 Feb 2021 15:36:05 -0800 Subject: [PATCH 2/5] adds Changelog and Usage --- CHANGELOG.md | 2 ++ USAGE.md | 2 ++ 2 files changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1fab01a72..baceb7bd5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,8 @@ Change log itself follows [Keep a CHANGELOG](http://keepachangelog.com) format. ## Unreleased ### Added +- `Faker.Dwelling` [[@winescout](https://github.com/winescout)] +- `Faker.Dwelling.En` [[@winescout](https://github.com/winescout)] ### Changed diff --git a/USAGE.md b/USAGE.md index 2b9bc4ac0..829d941f8 100644 --- a/USAGE.md +++ b/USAGE.md @@ -44,6 +44,8 @@ - [Faker.Date](lib/faker/date.ex) - [Faker.DateTime](lib/faker/datetime.ex) - [Faker.Dog.PtBr](lib/faker/dog/pt_br.ex) +- [Faker.Dwelling](lib/faker/dwelling.ex) +- [Faker.Dwelling.En](lib/faker/dwelling/en.ex) - [Faker.File](lib/faker/file.ex) From d31bffda60f16b4249934efac3752d62241764e6 Mon Sep 17 00:00:00 2001 From: Matthew Clark Date: Thu, 25 Feb 2021 15:43:55 -0800 Subject: [PATCH 3/5] adds room to dwelling --- lib/faker/dwelling.ex | 15 +++++++++++++++ lib/faker/dwelling/en.ex | 27 +++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/lib/faker/dwelling.ex b/lib/faker/dwelling.ex index 7bfc2188f..053dce08a 100644 --- a/lib/faker/dwelling.ex +++ b/lib/faker/dwelling.ex @@ -23,4 +23,19 @@ defmodule Faker.Dwelling do @spec dwelling_type :: String.t() localize(:dwelling_type) + @doc """ + Returns a room name string + + ## Examples + iex> Faker.Dwelling.room() + "kitchen" + iex> Faker.Dwelling.room() + "bathroom" + iex> Faker.Dwelling.room() + "dining room" + iex> Faker.Dwelling.room() + "living room" + """ + @spec room :: String.t() + localize(:room) end diff --git a/lib/faker/dwelling/en.ex b/lib/faker/dwelling/en.ex index 1222455ec..34c9042db 100644 --- a/lib/faker/dwelling/en.ex +++ b/lib/faker/dwelling/en.ex @@ -40,4 +40,31 @@ defmodule Faker.Dwelling.En do "Trulio", "Villa", ]) + + @doc """ + Returns a room name string + + ## Examples + iex> Faker.Dwelling.En.room() + "kitchen" + iex> Faker.Dwelling.En.room() + "bathroom" + iex> Faker.Dwelling.En.room() + "dining room" + iex> Faker.Dwelling.En.room() + "living room" + """ + @spec room :: String.t() + sampler(:room, [ + "kitchen", + "bathroom", + "bedroom", + "master bedroom", + "living room", + "dining room", + "entry way", + "garage", + "laundry room", + "basement" + ]) end From cd44de9a17f708006284cb858dfe710dec88b27d Mon Sep 17 00:00:00 2001 From: Matthew Clark Date: Thu, 25 Feb 2021 15:47:21 -0800 Subject: [PATCH 4/5] removes capitalization from dwelling types --- lib/faker/dwelling.ex | 8 +++---- lib/faker/dwelling/en.ex | 46 ++++++++++++++++++++-------------------- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/lib/faker/dwelling.ex b/lib/faker/dwelling.ex index 053dce08a..3665aba80 100644 --- a/lib/faker/dwelling.ex +++ b/lib/faker/dwelling.ex @@ -11,13 +11,13 @@ defmodule Faker.Dwelling do ## Examples iex> Faker.Dwelling.dwelling_type() - "Cycladic house" + "cycladic house" iex> Faker.Dwelling.dwelling_type() - "Shepard's hut" + "shepard's hut" iex> Faker.Dwelling.dwelling_type() - "Cycladic house" + "cycladic house" iex> Faker.Dwelling.dwelling_type() - "Earth house" + "earth house" """ @spec dwelling_type :: String.t() diff --git a/lib/faker/dwelling/en.ex b/lib/faker/dwelling/en.ex index 34c9042db..6ef58ef7d 100644 --- a/lib/faker/dwelling/en.ex +++ b/lib/faker/dwelling/en.ex @@ -10,35 +10,35 @@ defmodule Faker.Dwelling.En do ## Examples iex> Faker.Dwelling.dwelling_type() - "Cycladic house" + "cycladic house" iex> Faker.Dwelling.dwelling_type() - "Shepard's hut" + "shepard's hut" iex> Faker.Dwelling.dwelling_type() - "Cycladic house" + "cycladic house" iex> Faker.Dwelling.dwelling_type() - "Earth house" + "earth house" """ @spec dwelling_type() :: String.t() sampler(:dwelling_type, [ - "Bungalow", - "Cabin", - "Casa Particular", - "Chalet", - "Cottage", - "Cycladic house", - "Dammuso", - "Dome house", - "Earth house", - "House", - "Houseboat", - "Hut", - "Lighthouse", - "Pension", - "Shepard's hut", - "Tiny house", - "Townhouse", - "Trulio", - "Villa", + "bungalow", + "cabin", + "casa particular", + "chalet", + "cottage", + "cycladic house", + "dammuso", + "dome house", + "earth house", + "house", + "houseboat", + "hut", + "lighthouse", + "pension", + "shepard's hut", + "tiny house", + "townhouse", + "trulio", + "villa", ]) @doc """ From df4291df46d16e3009288e7627987f315df97823 Mon Sep 17 00:00:00 2001 From: Matthew Clark Date: Thu, 25 Feb 2021 16:04:15 -0800 Subject: [PATCH 5/5] mix format --- lib/faker/dwelling.ex | 3 +-- lib/faker/dwelling/en.ex | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/faker/dwelling.ex b/lib/faker/dwelling.ex index 3665aba80..606da4828 100644 --- a/lib/faker/dwelling.ex +++ b/lib/faker/dwelling.ex @@ -1,7 +1,6 @@ -defmodule Faker.Dwelling do +defmodule Faker.Dwelling do import Faker, only: [localize: 1] - @moduledoc """ Functions for generating Dwelling related data """ diff --git a/lib/faker/dwelling/en.ex b/lib/faker/dwelling/en.ex index 6ef58ef7d..cef15118d 100644 --- a/lib/faker/dwelling/en.ex +++ b/lib/faker/dwelling/en.ex @@ -38,7 +38,7 @@ defmodule Faker.Dwelling.En do "tiny house", "townhouse", "trulio", - "villa", + "villa" ]) @doc """