arithmetic_operation 2.0.2

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.
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ OWMwMDRlNmM4ZTFkMzc2NWUyY2M1ZmE4MmJlN2FkZTYxZDExYTgwMA==
5
+ data.tar.gz: !binary |-
6
+ MzVmMjI3YzY4MjVlZDlhZjQyZTNiYjFlNGZmOTNmNmMxNGEwZDY0Mw==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ OGRmNGQ1OTM2NjZlMGE1N2VlZWVhMmZiZTNjY2Q2YjRkZjZiMjZkNDIyNDU1
10
+ MjRjMGRkZjE4MDcyZWZiZjQyNjQyZWRlOTdjYzYzNWM5NmI1Y2YyYzExZGY4
11
+ YzU3NDE5MzY3Y2Q1NmQ4Mjk2NmVjNzIxZmY0YzkzODM2MWRmYWM=
12
+ data.tar.gz: !binary |-
13
+ ZjI1ZTI4Mjg4ZTRiNWE3N2IzOTUxNjM0NWYzMmQ5OTk1YWNjMTVhZmE1MmMy
14
+ MTIxYzg3YjFiYWE4YjYyMmI1ZDRmNDcwZTQxYWQ1MjMwNjcwNzlkNGZmMWRk
15
+ ZWQ5Y2MyYjA2YTdlZGM1NDQ1NmYzY2Y5YTZiMWJmYzlkNjU3MDg=
@@ -0,0 +1,8 @@
1
+ require 'rake/testtask'
2
+
3
+ Rake::TestTask.new do |t|
4
+ t.libs << 'test'
5
+ end
6
+
7
+ desc "Run tests"
8
+ task :default => :test
@@ -0,0 +1,9 @@
1
+ require 'arithmetic_operation'
2
+
3
+ puts ArithmeticOperation.add(ARGV[0],ARGV[1])
4
+
5
+ puts ArithmeticOperation.sub(ARGV[0],ARGV[1])
6
+
7
+ puts ArithmeticOperation.multiple(ARGV[0],ARGV[1])
8
+
9
+ puts ArithmeticOperation.divide(ARGV[0],ARGV[1])
@@ -0,0 +1,24 @@
1
+ class ArithmeticOperation
2
+
3
+ def self.add(val1 = 10 , val2 = 20)
4
+ val1.to_i + val2.to_i
5
+ end
6
+
7
+ def self.sub(val1 = 50 , val2 = 20)
8
+ val1.to_i - val2.to_i
9
+ end
10
+
11
+ def self.multiple(val1 = 100 , val2 = 20)
12
+ val1.to_i * val2.to_i
13
+ end
14
+
15
+ def self.divide(val1 = 100 , val2 = 20)
16
+ val1.to_i / val2.to_i
17
+ end
18
+
19
+ end
20
+
21
+ require 'arithmetic_operation/addition'
22
+ require 'arithmetic_operation/subtraction'
23
+ require 'arithmetic_operation/division'
24
+ require 'arithmetic_operation/multiplication'
@@ -0,0 +1,10 @@
1
+ class Addition
2
+ def initialize( val1,val2 )
3
+ @val1 = val1.to_i
4
+ @val2 = val2.to_i
5
+ end
6
+
7
+ def add
8
+ puts "#{@val1 + @val2}"
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ class Division
2
+ def initialize( val1,val2 )
3
+ @val1 = val1.to_i
4
+ @val2 = val2.to_i
5
+ end
6
+
7
+ def divide
8
+ puts "#{@val1 / @val2}"
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ class Multiplication
2
+ def initialize( val1,val2 )
3
+ @val1 = val1.to_i
4
+ @val2 = val2.to_i
5
+ end
6
+
7
+ def multiple
8
+ puts "#{@val1 * @val2}"
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ class Subtraction
2
+ def initialize( val1,val2 )
3
+ @val1 = val1.to_i
4
+ @val2 = val2.to_i
5
+ end
6
+
7
+ def sub
8
+ puts "#{@val1 - @val2}"
9
+ end
10
+ end
@@ -0,0 +1,25 @@
1
+ require 'test/unit'
2
+ require 'arithmetic_operation'
3
+
4
+ class ArithmeticOperationTest < Test::Unit::TestCase
5
+ def test_additon
6
+ assert_equal 30,
7
+ ArithmeticOperation.add(10,20)
8
+ end
9
+
10
+ def test_sub
11
+ assert_equal 20,
12
+ ArithmeticOperation.sub(30,10)
13
+ end
14
+
15
+ def test_multiple
16
+ assert_equal 200,
17
+ ArithmeticOperation.multiple(10,20)
18
+ end
19
+
20
+ def test_divide
21
+ assert_equal 5,
22
+ ArithmeticOperation.divide(100,20)
23
+ end
24
+
25
+ end
metadata ADDED
@@ -0,0 +1,52 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: arithmetic_operation
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.0.2
5
+ platform: ruby
6
+ authors:
7
+ - ketan
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-07-05 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Use Arithmetic Operation on ruby
14
+ email: mketanv@gmail.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - Rakefile
20
+ - bin/arithmetic_operation
21
+ - lib/arithmetic_operation.rb
22
+ - lib/arithmetic_operation/addition.rb
23
+ - lib/arithmetic_operation/division.rb
24
+ - lib/arithmetic_operation/multiplication.rb
25
+ - lib/arithmetic_operation/subtraction.rb
26
+ - test/test_arithmetic_operation.rb
27
+ homepage: http://rubygems.org/gems/arithmetic_operation
28
+ licenses: []
29
+ metadata: {}
30
+ post_install_message:
31
+ rdoc_options: []
32
+ require_paths:
33
+ - lib
34
+ required_ruby_version: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - ! '>='
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ required_rubygems_version: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ requirements: []
45
+ rubyforge_project:
46
+ rubygems_version: 2.3.0
47
+ signing_key:
48
+ specification_version: 3
49
+ summary: Arithmetic Operation!
50
+ test_files:
51
+ - test/test_arithmetic_operation.rb
52
+ has_rdoc: