diff --git a/.gitignore b/.gitignore index 886f714..83c635b 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,9 @@ /db/*.sqlite3 /db/*.sqlite3-* +# Ignore swp +*.swp + # Ignore all logfiles and tempfiles. /log/* /tmp/* diff --git a/Gemfile.lock b/Gemfile.lock index a394f98..d412c53 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@ GIT remote: git@github.com:M4THYOU/evil_gem.git - revision: 6709967f448c33418a7443918583f70b606bf3fb + revision: ce962d021b4b851e685a906bcb1c8ee6d837c4ca branch: main specs: evil_gem (0.0.0) @@ -76,7 +76,7 @@ GEM addressable (2.8.0) public_suffix (>= 2.0.2, < 5.0) bindex (0.8.1) - bootsnap (1.12.0) + bootsnap (1.13.0) msgpack (~> 1.2) builder (3.2.4) capybara (3.37.1) @@ -119,7 +119,7 @@ GEM method_source (1.0.0) mini_mime (1.1.2) minitest (5.16.2) - msgpack (1.5.3) + msgpack (1.5.4) net-imap (0.2.3) digest net-protocol @@ -135,7 +135,7 @@ GEM net-protocol timeout nio4r (2.5.8) - nokogiri (1.13.7-x86_64-darwin) + nokogiri (1.13.8-x86_64-darwin) racc (~> 1.4) public_suffix (4.0.7) puma (5.6.4) @@ -192,7 +192,7 @@ GEM sqlite3 (1.4.4) stimulus-rails (1.1.0) railties (>= 6.0.0) - strscan (3.0.3) + strscan (3.0.4) thor (1.2.1) timeout (0.3.0) turbo-rails (1.1.1) diff --git a/app/controllers/.home_controller.rb.swp b/app/controllers/.home_controller.rb.swp deleted file mode 100644 index 6a2dbd5..0000000 Binary files a/app/controllers/.home_controller.rb.swp and /dev/null differ diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 9c51224..0b90537 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -2,9 +2,9 @@ class HomeController < ApplicationController def index if params.has_key?(:query) - @num = Integer(params[:query]) rescue nil - unless @num.nil? - @res = EvenChecker.is_even?(@num) + @query = params[:query] + unless @query.nil? + @res = EvenChecker.is_even?(@query) end end diff --git a/app/views/home/.index.html.erb.swp b/app/views/home/.index.html.erb.swp deleted file mode 100644 index 3802ae5..0000000 Binary files a/app/views/home/.index.html.erb.swp and /dev/null differ diff --git a/app/views/home/index.html.erb b/app/views/home/index.html.erb index 9f775bd..4bbeb08 100644 --- a/app/views/home/index.html.erb +++ b/app/views/home/index.html.erb @@ -1,9 +1,9 @@ -

test

+

Check if your number is even!

-<% if @num.nil? %> -

invalid integer

+<% if @query.nil? %> +

Please enter a number:

<% else %> -

<%= @num %> is even?: <%= @res %>

+

<%= @query %> is even?: <%= @res %>

<% end %> <%= form_with url: root_path, method: :get do |form| %>