diff --git a/CHANGELOG.md b/CHANGELOG.md index 1ea0b17351..662438d2b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ### Latest update: 2018-06-11 ### Feature Request +- [PR #799](https://github.com/stympy/faker/pull/799) Faker::ElectricalComponents [@bheim6](https://github.com/bheim6) - [PR #1050](https://github.com/stympy/faker/pull/1050) Add Faker::Invoice to generate valid bank slip references [@onnimonni](https://github.com/onnimonni) - [PR #817](https://github.com/stympy/faker/pull/817) Faker::Lorem.multibyte for multibyte chars [@frankywahl](https://github.com/frankywahl) - [PR #877](https://github.com/stympy/faker/pull/877) Add Canada SIN generator in Faker::Code [@gkunwar](https://github.com/gkunwar) diff --git a/README.md b/README.md index 516c3ae409..38566f9914 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,7 @@ Contents - [Faker::Dune](doc/dune.md) - [Faker::Educator](doc/educator.md) - [Faker::ElderScrolls](doc/elder_scrolls.md) + - [Faker::ElectricalComponents](doc/electrical_components.md) - [Faker::Esport](doc/esport.md) - [Faker::Fallout](doc/fallout.md) - [Faker::FamilyGuy](doc/family_guy.md) diff --git a/doc/electrical_components.md b/doc/electrical_components.md new file mode 100644 index 0000000000..6aaa192701 --- /dev/null +++ b/doc/electrical_components.md @@ -0,0 +1,11 @@ +# Faker::ElectricalComponents + +It might be available in the next version. + +```ruby +Faker::ElectricalComponents.active #=> "Transistor" + +Faker::ElectricalComponents.passive #=> "Resistor" + +Faker::ElectricalComponents.electromechanical #=> "Toggle Switch" +``` diff --git a/lib/faker/electrical_components.rb b/lib/faker/electrical_components.rb new file mode 100644 index 0000000000..e4fb96f407 --- /dev/null +++ b/lib/faker/electrical_components.rb @@ -0,0 +1,19 @@ +module Faker + class ElectricalComponents < Base + flexible :electrical_components + + class << self + def active + fetch('electrical_components.active') + end + + def passive + fetch('electrical_components.passive') + end + + def electromechanical + fetch('electrical_components.electromechanical') + end + end + end +end diff --git a/lib/locales/en/electrical_components.yml b/lib/locales/en/electrical_components.yml new file mode 100644 index 0000000000..988b04cb45 --- /dev/null +++ b/lib/locales/en/electrical_components.yml @@ -0,0 +1,6 @@ +en: + faker: + electrical_components: + active: ["Diode", "LED", "Rectifier", "Transistor", "JFET", "MOSFET", "Integrated Circuit", "LCD", "Cathode Ray Tube", "Vacuum Tube", "Battery", "Fuel Cell", "Power Supply"] + passive: ["Resistor", "Potentiometer", "Trim Pot", "Varistor", "Capacitor", "Varicap Diode", "Inductor", "Transformer", "Generator", "Motor", "Solenoid", "Magnetic Amplifier", "Speaker", "Motion Sensor", "Accelerometer", "Thermocouple", "Antenna", "Oscillator", "Breadboard"] + electromechanical: ["Piezoelectric device", "crystal", "Ultrasonic Motor", "Terminal", "Socket", "Power Cord", "Toggle Switch", "Slide Switch", "DIP Switch", "Footswitch", "Keypad", "Circuit Breaker", "Fuse", "Printed Circuit Board"] \ No newline at end of file diff --git a/test/test_faker_electrical_components.rb b/test/test_faker_electrical_components.rb new file mode 100644 index 0000000000..3835b23e3a --- /dev/null +++ b/test/test_faker_electrical_components.rb @@ -0,0 +1,19 @@ +require File.expand_path(File.dirname(__FILE__) + '/test_helper.rb') + +class TestFakerElectricalComponents < Test::Unit::TestCase + def setup + @tester = Faker::ElectricalComponents + end + + def test_active + assert @tester.active.match(/\w+/) + end + + def test_passive + assert @tester.passive.match(/\w+/) + end + + def test_electromechanical + assert @tester.electromechanical.match(/\w+/) + end +end