ABCEvaluateMath 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 73f61b9cb0bcfb74257d6b308783d381423eeb7d
4
+ data.tar.gz: 692054837f0a5811fc1a5df89e89d652f4b2885d
5
+ SHA512:
6
+ metadata.gz: aea1aeeb70bf937b9650fd4f597c6b502c97f3c18700d456e14468b9458c9724a04f794acb493a9f9f29c48b2348b4efa22eb91213fe0799c136a72e102bf6f9
7
+ data.tar.gz: ab4688dd54886600cfe39b906a4b9a530253737be681c522af5ef0abba83064da71c68ec492d391160b764bb1eab92eff69c3d75aa79279427baf4d66ab384a8
@@ -0,0 +1,30 @@
1
+ #!/usr/bin/ruby
2
+
3
+ require 'ABCEvaluateMath\operations\Add'
4
+ require 'ABCEvaluateMath\operations\Subtraction'
5
+ require 'ABCEvaluateMath\operations\Div'
6
+ require 'ABCEvaluateMath\operations\Mult'
7
+
8
+ class EvaluateMath
9
+
10
+ def initialize()
11
+ @add = Add.new()
12
+ @subtraction = Subtraction.new()
13
+ @mult = Mult.new()
14
+ @div = Div.new()
15
+ end
16
+
17
+ def operation(a, b, ope)
18
+ case ope
19
+ when "+"
20
+ return @add.add(a, b)
21
+ when "-"
22
+ return @subtraction.subtraction(a, b)
23
+ when "*"
24
+ return @mult.mult(a, b)
25
+ when "/"
26
+ return @div.div(a, b)
27
+ end
28
+ end
29
+
30
+ end
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/ruby
2
+
3
+ class Add
4
+
5
+ def add(a, b)
6
+ return a + b
7
+ end
8
+
9
+ end
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/ruby
2
+
3
+ class Div
4
+
5
+ def div(a, b)
6
+ return a / b
7
+ end
8
+
9
+ end
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/ruby
2
+
3
+ class Mult
4
+
5
+ def mult(a, b)
6
+ return a * b
7
+ end
8
+
9
+ end
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/ruby
2
+
3
+ class Subtraction
4
+
5
+ def subtraction(a, b)
6
+ return a - b
7
+ end
8
+
9
+ end
metadata ADDED
@@ -0,0 +1,47 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ABCEvaluateMath
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Tu jefe
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-11-14 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: A simple math operations gem
14
+ email: jefe@gmail.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/ABCEvaluateMath/EvaluateMath.rb
20
+ - lib/ABCEvaluateMath/operations/Add.rb
21
+ - lib/ABCEvaluateMath/operations/Div.rb
22
+ - lib/ABCEvaluateMath/operations/Mult.rb
23
+ - lib/ABCEvaluateMath/operations/Subtraction.rb
24
+ homepage: http://rubygems.org/gems/ABCEvaluateMath
25
+ licenses: []
26
+ metadata: {}
27
+ post_install_message:
28
+ rdoc_options: []
29
+ require_paths:
30
+ - lib
31
+ required_ruby_version: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: '0'
36
+ required_rubygems_version: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ requirements: []
42
+ rubyforge_project:
43
+ rubygems_version: 2.6.14.4
44
+ signing_key:
45
+ specification_version: 3
46
+ summary: Hola!
47
+ test_files: []