real_multiplication 0.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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a416dd3710fefd78d91c6d372cf066d6b055d60e
4
+ data.tar.gz: a2c789b556be8c84a0b02f57b4ce186d0bd71560
5
+ SHA512:
6
+ metadata.gz: 77222aaa565b811096ee7c6e0e78bd3e8124913a70a54acfd7290ade5df057802de0738fdb44c1c3ebf6acf478fc38e60662531c25cc9324e6e7ceaae6fa10ba
7
+ data.tar.gz: 70a9ed8978c97e8abd8a8ab962955ded0a02f58361f7878b80d16df155755ea8b368b680d65370f14ffa64206707939a7f3a7fe78f547bdc0d789937165581fb
data/README.md ADDED
@@ -0,0 +1,42 @@
1
+ # RealMultiplication
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'real_multiplication'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install real_multiplication
20
+
21
+ ## Usage
22
+
23
+ TODO: Write usage instructions here
24
+
25
+ ## Contributing
26
+
27
+ 1. Fork it ( https://github.com/[amitsuroliya]/real_multiplication/fork )
28
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
29
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
30
+ 4. Push to the branch (`git push origin my-new-feature`)
31
+ 5. Create a new Pull Request
32
+
33
+
34
+ Run :
35
+
36
+ We can perform this algorithm by
37
+
38
+ ```
39
+ RealMultiplication.result
40
+
41
+ ```
42
+
@@ -0,0 +1,14 @@
1
+ require 'real_multiplication/version'
2
+ require 'real_multiplication/engine'
3
+ require 'real_multiplication/values'
4
+ require 'real_multiplication/multiply'
5
+ module RealMultiplication
6
+
7
+ def self.result
8
+ a,b = RealMultiplication::Values.gets_it
9
+ result = RealMultiplication::Multiply.result(a,b)
10
+ puts "Multiplication of "+ a.to_s + " and "+ b.to_s + " is : "+ result.to_s
11
+ return result
12
+ end
13
+
14
+ end
@@ -0,0 +1,2 @@
1
+ class RealMultiplication::Engine
2
+ end
@@ -0,0 +1,17 @@
1
+ module RealMultiplication
2
+ class Multiply
3
+
4
+ def self.result(a,b)
5
+ mul = 0
6
+ size = b.to_s.size
7
+ begin
8
+ rem = b % 10
9
+ diff = (size - b.to_s.size)
10
+ mul += (diff == 0) ? (a * rem) : (a * rem * diff * 10)
11
+ b = b / 10
12
+ end until b == 0
13
+ mul
14
+ end
15
+
16
+ end
17
+ end
@@ -0,0 +1,30 @@
1
+ # = real_multiplication/value.rb
2
+ #
3
+ # Author:: Amit Suroliya <amitkumarsuroliya@gmail.com>
4
+ # License:: You can redistribute it and/or modify it under the same term as Ruby.
5
+ # Revision:: $Id$
6
+ #
7
+ # See URI for general documentation
8
+ #
9
+
10
+ module RealMultiplication
11
+ #
12
+ # The syntax of RealMultiplication is defined in RFC1738 section 3.3.
13
+ #
14
+ # Note that the RealMultiplication library allows us to implements
15
+ # multiplication between two numbers.
16
+ #
17
+
18
+ class Values
19
+
20
+ def self.gets_it
21
+ puts "Enter A :"
22
+ a = gets.chomp.to_i
23
+ puts "Enter B :"
24
+ b = gets.chomp.to_i
25
+ return a,b
26
+ end
27
+
28
+ end
29
+
30
+ end
@@ -0,0 +1,3 @@
1
+ module RealMultiplication
2
+ VERSION = "0.0.2"
3
+ end
metadata ADDED
@@ -0,0 +1,77 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: real_multiplication
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Amit Suroliya
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-01-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ description: Real Life Multiplication of two integers
42
+ email: amitkumarsuroliya@gmail.com
43
+ executables: []
44
+ extensions: []
45
+ extra_rdoc_files: []
46
+ files:
47
+ - README.md
48
+ - lib/real_multiplication.rb
49
+ - lib/real_multiplication/engine.rb
50
+ - lib/real_multiplication/multiply.rb
51
+ - lib/real_multiplication/values.rb
52
+ - lib/real_multiplication/version.rb
53
+ homepage: http://rubygems.org/gems/real_multiplication
54
+ licenses:
55
+ - MIT
56
+ metadata: {}
57
+ post_install_message:
58
+ rdoc_options: []
59
+ require_paths:
60
+ - lib
61
+ required_ruby_version: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ required_rubygems_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ requirements: []
72
+ rubyforge_project:
73
+ rubygems_version: 2.4.5
74
+ signing_key:
75
+ specification_version: 4
76
+ summary: Real Life Multiplication
77
+ test_files: []