From 6903394dac0e756382bc27a74ecef247172ab887 Mon Sep 17 00:00:00 2001 From: Cesar Herrera Date: Tue, 22 Aug 2023 11:37:27 -0400 Subject: [PATCH 1/5] Add linters to the project --- .github/workflows/linters.yml | 20 ++++++++++++++ .rubocop.yml | 52 +++++++++++++++++++++++++++++++++++ Gemfile | 2 ++ Gemfile.lock | 40 +++++++++++++++++++++++++++ morse.rb | 0 5 files changed, 114 insertions(+) create mode 100644 .github/workflows/linters.yml create mode 100644 .rubocop.yml create mode 100644 Gemfile create mode 100644 Gemfile.lock create mode 100644 morse.rb diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml new file mode 100644 index 0000000..60be81c --- /dev/null +++ b/.github/workflows/linters.yml @@ -0,0 +1,20 @@ +name: Linters + +on: pull_request + +jobs: + rubocop: + name: Rubocop + runs-on: ubuntu-22.04 + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-ruby@v1 + with: + ruby-version: ">=3.1.x" + - name: Setup Rubocop + run: | + gem install --no-document rubocop -v '>= 1.0, < 2.0' # https://docs.rubocop.org/en/stable/installation/ + [ -f .rubocop.yml ] || wget https://raw.githubusercontent.com/microverseinc/linters-config/master/ruby/.rubocop.yml + - name: Rubocop Report + run: rubocop --color \ No newline at end of file diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 0000000..4948d48 --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,52 @@ +AllCops: + NewCops: enable + Exclude: + - "Guardfile" + - "Rakefile" + - "node_modules/**/*" + + DisplayCopNames: true + +Layout/LineLength: + Max: 120 +Metrics/MethodLength: + Max: 20 +Metrics/AbcSize: + Max: 50 +Metrics/ClassLength: + Max: 150 +Metrics/BlockLength: + IgnoredMethods: ['describe'] + Max: 30 + + +Style/Documentation: + Enabled: false +Style/ClassAndModuleChildren: + Enabled: false +Style/EachForSimpleLoop: + Enabled: false +Style/AndOr: + Enabled: false +Style/DefWithParentheses: + Enabled: false +Style/FrozenStringLiteralComment: + EnforcedStyle: never + +Layout/HashAlignment: + EnforcedColonStyle: key +Layout/ExtraSpacing: + AllowForAlignment: false +Layout/MultilineMethodCallIndentation: + Enabled: true + EnforcedStyle: indented +Lint/RaiseException: + Enabled: false +Lint/StructNewOverride: + Enabled: false +Style/HashEachMethods: + Enabled: false +Style/HashTransformKeys: + Enabled: false +Style/HashTransformValues: + Enabled: false \ No newline at end of file diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..3fe9350 --- /dev/null +++ b/Gemfile @@ -0,0 +1,2 @@ +source 'https://rubygems.org' +gem 'rubocop', '>= 1.0', '< 2.0' diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..82c98ee --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,40 @@ +GEM + remote: https://rubygems.org/ + specs: + ast (2.4.2) + base64 (0.1.1) + json (2.6.3) + language_server-protocol (3.17.0.3) + parallel (1.23.0) + parser (3.2.2.3) + ast (~> 2.4.1) + racc + racc (1.7.1) + rainbow (3.1.1) + regexp_parser (2.8.1) + rexml (3.2.6) + rubocop (1.56.1) + base64 (~> 0.1.1) + json (~> 2.3) + language_server-protocol (>= 3.17.0) + parallel (~> 1.10) + parser (>= 3.2.2.3) + rainbow (>= 2.2.2, < 4.0) + regexp_parser (>= 1.8, < 3.0) + rexml (>= 3.2.5, < 4.0) + rubocop-ast (>= 1.28.1, < 2.0) + ruby-progressbar (~> 1.7) + unicode-display_width (>= 2.4.0, < 3.0) + rubocop-ast (1.29.0) + parser (>= 3.2.1.0) + ruby-progressbar (1.13.0) + unicode-display_width (2.4.2) + +PLATFORMS + x86_64-linux + +DEPENDENCIES + rubocop (>= 1.0, < 2.0) + +BUNDLED WITH + 2.4.19 diff --git a/morse.rb b/morse.rb new file mode 100644 index 0000000..e69de29 From 9dc42b8c460d0b8f89049327c0d09b823daeea61 Mon Sep 17 00:00:00 2001 From: Cesar Herrera Date: Tue, 22 Aug 2023 11:40:24 -0400 Subject: [PATCH 2/5] Add code morse object to the project --- morse.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/morse.rb b/morse.rb index e69de29..8a1f1ba 100644 --- a/morse.rb +++ b/morse.rb @@ -0,0 +1,9 @@ +# Hash of the Morse symbols and their respective leters +MORSE_CODE = { + ".-" => "A", "-..." => "B", "-.-." => "C", "-.." => "D", "." => "E", + "..-." => "F", "--." => "G", "...." => "H", ".." => "I", ".---" => "J", + "-.-" => "K", ".-.." => "L", "--" => "M", "-." => "N", "---" => "O", + ".--." => "P", "--.-" => "Q", ".-." => "R", "..." => "S", "-" => "T", + "..-" => "U", "...-" => "V", ".--" => "W", "-..-" => "X", "-.--" => "Y", + "--.." => "Z" +} From a4f38a08bc4a69f94fce49e65afda6c518abb909 Mon Sep 17 00:00:00 2001 From: "Claudia P. R. Soto" <97201255+ClaudiaRojasSoto@users.noreply.github.com> Date: Tue, 22 Aug 2023 12:11:46 -0400 Subject: [PATCH 3/5] Add methods to decode characters, words and a full mesaage ussing the hash --- morse.rb | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/morse.rb b/morse.rb index 8a1f1ba..170f068 100644 --- a/morse.rb +++ b/morse.rb @@ -1,9 +1,28 @@ # Hash of the Morse symbols and their respective leters MORSE_CODE = { - ".-" => "A", "-..." => "B", "-.-." => "C", "-.." => "D", "." => "E", - "..-." => "F", "--." => "G", "...." => "H", ".." => "I", ".---" => "J", - "-.-" => "K", ".-.." => "L", "--" => "M", "-." => "N", "---" => "O", - ".--." => "P", "--.-" => "Q", ".-." => "R", "..." => "S", "-" => "T", - "..-" => "U", "...-" => "V", ".--" => "W", "-..-" => "X", "-.--" => "Y", - "--.." => "Z" -} + '.-' => 'A', '-...' => 'B', '-.-.' => 'C', '-..' => 'D', '.' => 'E', + '..-.' => 'F', '--.' => 'G', '....' => 'H', '..' => 'I', '.---' => 'J', + '-.-' => 'K', '.-..' => 'L', '--' => 'M', '-.' => 'N', '---' => 'O', + '.--.' => 'P', '--.-' => 'Q', '.-.' => 'R', '...' => 'S', '-' => 'T', + '..-' => 'U', '...-' => 'V', '.--' => 'W', '-..-' => 'X', '-.--' => 'Y', + '--..' => 'Z' +}.freeze + +# Method to decode a Morse character +def decode_char(morse_char) + MORSE_CODE[morse_char] +end + +# Method to decode a Morse word +def decode_word(morse_word) + morse_word.split.map { |morse_char| decode_char(morse_char) }.join +end + +# Method to decode an entire Morse message +def decode(morse_message) + morse_message.split(' ').map { |morse_word| decode_word(morse_word) }.join(' ') +end + +message = '.- -... --- -..- ..-. ..- .-.. .-.. --- ..-. .-. ..- -... .. . ...' +decoded_message = decode(message) +puts "Decoded message: #{decoded_message}" From a0e56b965b2cf281e1980e26bf171e9e849ba444 Mon Sep 17 00:00:00 2001 From: "Claudia P. R. Soto" <97201255+ClaudiaRojasSoto@users.noreply.github.com> Date: Tue, 22 Aug 2023 12:12:44 -0400 Subject: [PATCH 4/5] Upload the Gemfile.lock installing the bundle --- Gemfile.lock | 1 + 1 file changed, 1 insertion(+) diff --git a/Gemfile.lock b/Gemfile.lock index 82c98ee..986c969 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -31,6 +31,7 @@ GEM unicode-display_width (2.4.2) PLATFORMS + x86_64-darwin-22 x86_64-linux DEPENDENCIES From 2c9030be29b17f0bca61d019746adfd3faa64bc3 Mon Sep 17 00:00:00 2001 From: "Claudia P. R. Soto" <97201255+ClaudiaRojasSoto@users.noreply.github.com> Date: Tue, 22 Aug 2023 12:26:48 -0400 Subject: [PATCH 5/5] Add the licence from Mit and create the readme file with the description of the app --- MIT.md | 7 +++ README.MD | 166 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 173 insertions(+) create mode 100644 MIT.md create mode 100644 README.MD diff --git a/MIT.md b/MIT.md new file mode 100644 index 0000000..83d214a --- /dev/null +++ b/MIT.md @@ -0,0 +1,7 @@ +Copyright 2023, Claudia Rojas + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the software, and to permit persons to whom the software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the software. + +THE software IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE software OR THE USE OR OTHER DEALINGS IN THE software. \ No newline at end of file diff --git a/README.MD b/README.MD new file mode 100644 index 0000000..01f7c4c --- /dev/null +++ b/README.MD @@ -0,0 +1,166 @@ + + + + + + + + +# 📗 Table of Contents + +- [📗 Table of Contents](#-table-of-contents) +- [📖 Decoding\_Morse\_Code ](#-decoding_morse_code-) + - [🛠 Built With ](#-built-with-) + - [Tech Stack ](#tech-stack-) + - [Key Features ](#key-features-) + - [🚀 Live Demo ](#-live-demo-) + - [💻 Getting Started ](#-getting-started-) + - [Setup](#setup) + - [👥 Authors ](#-authors-) + - [🔭 Future Features ](#-future-features-) + - [🤝 Contributing ](#-contributing-) + - [⭐️ Show your support ](#️-show-your-support-) + - [🙏 Acknowledgments ](#-acknowledgments-) + - [📝 License ](#-license-) + + + +# 📖 Decoding_Morse_Code + +The purpose of this app is to decode a message encrypted in morse code using Ruby as the programming language. It adheres to best practices and verifies results using Rubocop. + + +## 🛠 Built With + +The project is built using SQL for database management. Getting Started Follow these steps to understand and work on the project: + + +### Tech Stack + +The project is built using the following technologies: + + +
+Ruby + +
+ + + +### Key Features + + +- **Hash** +- **Methods** +- **Rubocop install** +- **Gems install** + +

(back to top)

+ + + +## 🚀 Live Demo + +Unfortunately, there is no live demo available for this project at the moment. + +

(back to top)

+ + + +## 💻 Getting Started + +## Setup + +To get a local copy up and running, follow these steps. + +1. Clone this repository to your local machine: + +``` +git clone https://github.com/ClaudiaRojasSoto/Decoding_Morse_Code.git + +``` + + +## 👥 Authors + +👤 **Claudia Rojas** + +- GitHub: [@githubhandle](https://github.com/ClaudiaRojasSoto) +- LinkedIn: [LinkedIn](https://www.linkedin.com/in/claudia-rojas-soto/) + +👤 **Cesar Herrera** + +- GitHub: [@githubhandle](https://github.com/CesarHerr) +- LinkedIn: [LinkedIn](https://www.linkedin.com/in/cesarHerr/) + +

(back to top)

+ + + +## 🔭 Future Features + +- [ ] **User Interface** + +

(back to top)

+ + + +## 🤝 Contributing + +Contributions, issues, and feature requests are welcome! + +Feel free to check the [issues page](https://github.com/ClaudiaRojasSoto/Decoding_Morse_Code/issues). + +

(back to top)

+ + + +## ⭐️ Show your support + + +If you like this project or if it helped you, please give a ⭐️. I'd really appreciate it! + +

(back to top)

+ + + +## 🙏 Acknowledgments + +I would like to thank Microverse and all my peers and colleagues at Microverse for giving me the opportunity to work on this project. + +

(back to top)

+ + + +

(back to top)

+ + + +## 📝 License + +This project is [MIT](MIT.md). + + +

(back to top)