fizzbuzz_super 0.0.7 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/fizzbuzz.rb +28 -21
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b0f33bd559ac0c06e43f2a7c76deed767a74402828280b53187ccaad5511a92c
4
- data.tar.gz: 6f1ed02391abd07740f1934c370be475110235d24d9bb0950d914328a18a2cc4
3
+ metadata.gz: c927fcd1b77e67d45e59ac49e922e0d70f4464df4cc35fa8c20f0db9714602ff
4
+ data.tar.gz: 2f04decc31b3f95cc71ecadb58361df65302965c5e434fc8ff5530247e5e20ad
5
5
  SHA512:
6
- metadata.gz: 8744f62359f8b938e37e4d3ded5067736fe64ed8dd8e63b4653d234b3fa38a642f8dfe50410a98560f26803b80d8d3f207564062fb83f2e8367958bfb7fd03d2
7
- data.tar.gz: d6bc4aade89523b18e18aefedc5a6c5d3143f1947ff09646e73b564388594e86532e30b7c857dc87ca2ed9bc521acdfbd56afecb0517d6834c857c65b4905db5
6
+ metadata.gz: a4a34f9504e0f3394947c66ff2103d5e2cdfbcd6df5fbda7187fee167f17b393d03b4794afb0cb02bc1353ffda8dcd24fe9bb0a7c49e02092d078436066a6277
7
+ data.tar.gz: 18f9a24ca9c043f0f0ed2155184f2a2c88bb538f1b009198317f8331e234d775d869b2418de26123f28d3c6e7fb50ec5a7853fa585dcd1e1501f36bd30e1f148
data/lib/fizzbuzz.rb CHANGED
@@ -1,26 +1,33 @@
1
1
 
2
- module FizzBuzz
3
- def self.check_fizzbuzz(n)
4
- if n % 15 == 0
5
- "#{n} FizzBuzz"
6
- elsif n % 3 == 0
7
- "#{n} Fizz"
8
- elsif n % 5 == 0
9
- "#{n} Buzz"
10
- end
11
- end
12
-
13
- def self.fizzbuzz(*args)
14
- start = args[0]
15
- stop = args[1]
16
- check = !start.nil? && !stop.nil? && (start < stop)
17
- if check
2
+ begin
3
+ require './error_handle'
4
+ class FizzBuzz
5
+ class << self
6
+ def check_fizzbuzz(n)
7
+ if n % 15 == 0
8
+ "#{n} FizzBuzz"
9
+ elsif n % 3 == 0
10
+ "#{n} Fizz"
11
+ elsif n % 5 == 0
12
+ "#{n} Buzz"
13
+ end
14
+ end
18
15
 
19
- (start..stop).each do |i|
20
- puts " #{check_fizzbuzz(i)}" unless check_fizzbuzz(i).nil?
16
+ def fizzbuzz(*args)
17
+ start = args[0]
18
+ stop = args[1]
19
+ check = ErrorHandle.error_check(*args)
20
+ if check
21
+ puts 'no error'
22
+ (start..stop).each do |i|
23
+ puts " #{check_fizzbuzz(i)}" unless check_fizzbuzz(i).nil?
24
+ end
25
+ else
26
+ puts 'Invalid Data'
27
+ end
28
+ end
21
29
  end
22
- else
23
- puts 'Invalid Data'
24
30
  end
25
- end
31
+ rescue NameError
32
+ raise 'Undefined Variable'
26
33
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fizzbuzz_super
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shrudhin V Raj
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-03 00:00:00.000000000 Z
11
+ date: 2019-12-04 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A simple FizzBuzz gem for Developers
14
14
  email: shrudhin@foradian.com