sneaky_mani 0.1.0 → 0.1.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d492fe934fb217cd660aa4d5f07c00fcbe5dd435ae5554b61398eef7d264c527
4
- data.tar.gz: 2156a6276c960de45bd2cf5b7c42d55812ec486daf506a4921997dfda707446d
3
+ metadata.gz: 3776d7c4b3919d5bee8a99371f4cc2bf8775ea1243f874dde69eca5be48b75cb
4
+ data.tar.gz: 2b5a317020b84b455aa7901ce0d359b95e73ab6e4d8ad9e787a45db741964a0e
5
5
  SHA512:
6
- metadata.gz: d96118ef5da662e03c4f444c445d69c387044cdeb3cdcf3e06aa5ee39da486ba66c7c67eadbce328ca2afbaf8aeccb2c217b28081dcf18a3d36c6e5989906406
7
- data.tar.gz: 83cd515ed329c9c94df6c3aa37a3e0b27c3162b833252e0ddb1fbf4cea98c09ea0becd2d061ff83dd37316e381d2370112bf827931c1a52af73dabe6aadff0de
6
+ metadata.gz: e9966f6cd93464075b1978ea3f786128623b4de15cf4588f0abb470d045f86d79baf4213d60bf2d60cb2ad43c76521208b40a8c457a2972299f309d0ccb0377d
7
+ data.tar.gz: d2e1d0758561f8d53c4e651aa24b933174028d89f41d2b2c1705a6691f476aa819ca6314ec93d61dac3ae89c42f363a0af094fd29ee897a891fe86ae6092e9b5
data/Gemfile.lock ADDED
@@ -0,0 +1,40 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ sneaky_mani (0.1.1)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ ast (2.4.2)
10
+ parallel (1.21.0)
11
+ parser (3.0.2.0)
12
+ ast (~> 2.4.1)
13
+ rainbow (3.0.0)
14
+ rake (13.0.6)
15
+ regexp_parser (2.1.1)
16
+ rexml (3.2.5)
17
+ rubocop (1.21.0)
18
+ parallel (~> 1.10)
19
+ parser (>= 3.0.0.0)
20
+ rainbow (>= 2.2.2, < 4.0)
21
+ regexp_parser (>= 1.8, < 3.0)
22
+ rexml
23
+ rubocop-ast (>= 1.9.1, < 2.0)
24
+ ruby-progressbar (~> 1.7)
25
+ unicode-display_width (>= 1.4.0, < 3.0)
26
+ rubocop-ast (1.11.0)
27
+ parser (>= 3.0.1.1)
28
+ ruby-progressbar (1.11.0)
29
+ unicode-display_width (2.1.0)
30
+
31
+ PLATFORMS
32
+ x64-mingw32
33
+
34
+ DEPENDENCIES
35
+ rake (~> 13.0)
36
+ rubocop (~> 1.7)
37
+ sneaky_mani!
38
+
39
+ BUNDLED WITH
40
+ 2.2.27
@@ -0,0 +1,38 @@
1
+ class String
2
+ def integer?
3
+ return true if self =~ /^[1-9]\d*(\.\d+)?$/
4
+ false
5
+ end
6
+ end
7
+
8
+ module SneakyMani
9
+
10
+ class Builder
11
+ def initialize total:, gratuity:
12
+ @total = total
13
+ @gratuity = gratuity
14
+ end
15
+
16
+ def generate
17
+ return calculation if number_based?
18
+ string_based
19
+ end
20
+
21
+ def number_based?
22
+ (@gratuity.is_a? Numeric) || (@gratuity.integer?)
23
+ end
24
+
25
+ def string_based
26
+ case @gratuity.downcase
27
+ when 'high' then calculation 25
28
+ when 'standard' then calculation 18
29
+ when 'low' then calculation 15
30
+ end
31
+ end
32
+
33
+ def calculation gratuity = @gratuity
34
+ @total += @total * (gratuity.to_f / 100)
35
+ end
36
+ end
37
+
38
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SneakyMani
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
data/lib/sneaky_mani.rb CHANGED
@@ -1,11 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "sneaky_mani/version"
4
+ require_relative "sneaky_mani/builder"
4
5
 
5
6
  module SneakyMani
6
7
  class Error < StandardError; end
7
8
  # Your code goes here...
8
- def greet_user(name)
9
- puts "Hello #{name}, thanks for using my Gem"
10
- end
11
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sneaky_mani
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Manikanta
@@ -20,12 +20,14 @@ files:
20
20
  - ".rubocop.yml"
21
21
  - CHANGELOG.md
22
22
  - Gemfile
23
+ - Gemfile.lock
23
24
  - LICENSE.txt
24
25
  - README.md
25
26
  - Rakefile
26
27
  - bin/console
27
28
  - bin/setup
28
29
  - lib/sneaky_mani.rb
30
+ - lib/sneaky_mani/builder.rb
29
31
  - lib/sneaky_mani/version.rb
30
32
  - sneaky_mani.gemspec
31
33
  homepage: https://github.com/Mani082/sneaky_mani