Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Adding Industry Segments Class #1148

Merged
merged 2 commits into from
Jul 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ Contents
- [Faker::Hobbit](doc/hobbit.md)
- [Faker::HowIMetYourMother](doc/how_i_met_your_mother.md)
- [Faker::IDNumber](doc/id_number.md)
- [Faker::IndustrySegments](doc/industry_segments.md)
- [Faker::Internet](doc/internet.md)
- [Faker::Invoice](doc/invoice.md)
- [Faker::Job](doc/job.md)
Expand Down
11 changes: 11 additions & 0 deletions doc/industry_segments.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Faker::IndustrySegments

```ruby
Faker::IndustrySegments.industry #=> "Basic Materials"

Faker::IndustrySegments.super_sector #=> "Basic Resources"

Faker::IndustrySegments.sector #=> "Industrial Metals & Mining"

Faker::IndustrySegments.sub_sector #=> "Nonferrous Metals"
```
24 changes: 24 additions & 0 deletions lib/faker/industry_segments.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# encoding: utf-8
module Faker
class IndustrySegments < Base
flexible :industry_segments

class << self
def industry
fetch('industry_segments.industry')
end

def super_sector
fetch('industry_segments.super_sector')
end

def sector
fetch('industry_segments.sector')
end

def sub_sector
fetch('industry_segments.sub_sector')
end
end
end
end
7 changes: 7 additions & 0 deletions lib/locales/en/industry_segments.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
en:
faker:
industry_segments:
industry: ["Oil & Gas", "Basic Materials", "Industrials", "Consumer Goods", "Health Care", "Consumer Services", "Telecommunications", "Utilities", "Financials", "Technology"]
super_sector: ["Oil & Gas", "Chemicals", "Basic Resources", "Construction & Materials", "Industrial Goods & Services", "Automobiles & Parts", "Food & Beverage", "Personal & Household Goods", "Health Care", "Retail", "Media", "Travel & Leisure", "Telecommunications", "Utilities", "Banks", "Insurance", "Real Estate", "Financial Services", "Technology"]
sector: ["Oil & Gas Producers", "Oil Equipment, Services & Distribution", "Alternative Energy", "Chemicals", "Forestry & Paper", "Industrial Metals & Mining", "Mining", "Construction & Materials", "Aerospace & Defense", "General Industrials", "Electronic & Electrical Equipment", "Industrial Engineering", "Industrial Transportation", "Support Services", "Automobiles & Parts", "Beverages", "Food Producers", "Household Goods & Home Construction", "Leisure Goods", "Personal Goods", "Tobacco", "Health Care Equipment & Services", "Pharmaceuticals & Biotechnology", "Food & Drug Retailers", "General Retailers", "Media", "Travel & Leisure", "Fixed Line Telecommunications", "Mobile Telecommunications", "Electricity", "Gas, Water & Multiutilities", "Banks", "Nonlife Insurance", "Life Insurance", "Real Estate Investment & Services", "Real Estate Investment Trusts", "Financial Services", "Equity Investment Instruments", "Nonequity Investment Instruments", "Software & Computer Services", "Technology Hardware & Equipment"]
sub_sector: ["Exploration & Production", "Integrated Oil & Gas", "Oil Equipment & Services", "Pipelines", "Renewable Energy Equipment", "Alternative Fuels", "Commodity Chemicals", "Specialty Chemicals", "Forestry", "ÊPaper", "Aluminum", "Nonferrous Metals", "Iron & Steel", "Coal", "Diamonds & Gemstones", "General Mining", "Gold Mining", "Platinum & Precious Metals", "Building Materials & Fixtures", "Heavy Construction", "Aerospace", "Defense", "Containers & Packaging", "Diversified Industrials", "Electrical Components & Equipment", "Electronic Equipment", "Commercial Vehicles & Trucks", "Industrial Machinery", "Delivery Services", "Marine Transportation", "Railroads", "Transportation Services", "Trucking", "Business Support Services", "Business Training & Employment Agencies", "Financial Administration", "Industrial Suppliers", "Waste & Disposal Services", "Automobiles", "Auto Parts", "Tires", "Brewers", "Distillers & Vintners", "Soft Drinks", "Farming & Fishing", "Food Products", "Durable Household Products", "Nondurable Household Products", "Furnishings", "Home Construction", "Consumer Electronics", "Recreational Products", "Toys", "Clothing & Accessories", "Footwear", "Personal Products", "Tobacco", "Health Care Providers", "Medical Equipment", "Medical Supplies", "Biotechnology", "Pharmaceuticals", "Drug Retailers", "Food Retailers & Wholesalers", "Apparel Retailers", "Broadline Retailers", "Home Improvement Retailers", "Specialized Consumer Services", "Specialty Retailers", "Broadcasting & Entertainment", "Media Agencies", "Publishing", "Airlines", "Gambling", "Hotels", "Recreational Services", "Restaurants & Bars", "Travel & Tourism", "Fixed Line Telecommunications", "Mobile Telecommunications", "Conventional Electricity", "Alternative Electricity", "Gas Distribution", "Multiutilities", "Water", "Banks", "Full Line Insurance", "Insurance Brokers", "Property & Casualty Insurance", "Reinsurance", "Life Insurance", "Real Estate Holding & Development", "Real Estate Services", "Industrial & Office REITs", "Retail REITs", "Residential REITs", "Diversified REITs", "Specialty REITs", "Mortgage REITs", "Hotel & Lodging REITs", "Asset Managers", "Consumer Finance", "Specialty Finance", "Investment Services", "Mortgage Finance", "Equity Investment Instruments", "Nonequity Investment Instruments", "Computer Services", "Internet", "Software", "Computer Hardware", "Electronic Office Equipment", "Semiconductors", "Telecommunications Equipment"]
25 changes: 25 additions & 0 deletions test/test_faker_industry_segments.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
require File.expand_path(File.dirname(__FILE__) + '/test_helper.rb')

class TestFakerIndustrySegments < Test::Unit::TestCase

def setup
@tester = Faker::IndustrySegments
end

def test_industry
assert @tester.industry.match(/(\w+\.? ?){2,3}/)
end

def test_super_sector
assert @tester.super_sector.match(/(\w+\.? ?){2,3}/)
end

def test_sector
assert @tester.sector.match(/(\w+\.? ?){2,3}/)
end

def test_sub_sector
assert @tester.sub_sector.match(/(\w+\.? ?){2,3}/)
end

end