simple_converter 0.0.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.
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +1 -0
- data/lib/simple_converter.rb +53 -0
- data/lib/simple_converter/version.rb +3 -0
- data/simple_converter.gemspec +19 -0
- metadata +72 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Copyright (c) 2013 TODO: Write your name
|
|
2
|
+
|
|
3
|
+
MIT License
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# SimpleConverter
|
|
2
|
+
|
|
3
|
+
TODO: Write a gem description
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Add this line to your application's Gemfile:
|
|
8
|
+
|
|
9
|
+
gem 'simple_converter'
|
|
10
|
+
|
|
11
|
+
And then execute:
|
|
12
|
+
|
|
13
|
+
$ bundle
|
|
14
|
+
|
|
15
|
+
Or install it yourself as:
|
|
16
|
+
|
|
17
|
+
$ gem install simple_converter
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
TODO: Write usage instructions here
|
|
22
|
+
|
|
23
|
+
## Contributing
|
|
24
|
+
|
|
25
|
+
1. Fork it
|
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
|
29
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require "bundler/gem_tasks"
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
require "simple_converter/version"
|
|
2
|
+
|
|
3
|
+
class Float
|
|
4
|
+
def miles_to_km
|
|
5
|
+
unit = self.to_f
|
|
6
|
+
return unit*1.609344
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def km_to_miles
|
|
10
|
+
unit = self.to_f
|
|
11
|
+
return unit/1.609344
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def cls_to_frah
|
|
15
|
+
unit = self.to_f
|
|
16
|
+
return unit*33.8
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def frah_to_cls
|
|
20
|
+
unit = self.to_f
|
|
21
|
+
return unit/33.8
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def feet_to_cm
|
|
25
|
+
unit = self.to_f
|
|
26
|
+
return unit*30.48
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def cm_to_feet
|
|
30
|
+
unit = self.to_f
|
|
31
|
+
return unit/30.48
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def gallon_to_liter
|
|
35
|
+
unit = self.to_f
|
|
36
|
+
return unit*3.7854118
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def liter_to_gallon
|
|
40
|
+
unit = self.to_f
|
|
41
|
+
return unit/3.7854118
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def pound_to_kg
|
|
45
|
+
unit = self.to_f
|
|
46
|
+
return unit*0.45359237
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def kg_to_pound
|
|
50
|
+
unit = self.to_f
|
|
51
|
+
return unit/0.45359237
|
|
52
|
+
end
|
|
53
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require 'simple_converter/version'
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |gem|
|
|
7
|
+
gem.name = "simple_converter"
|
|
8
|
+
gem.version = SimpleConverter::VERSION
|
|
9
|
+
gem.authors = "Srinivas Prabhu Ramanna"
|
|
10
|
+
gem.email = "Srinivas.prabhur@gmail.com"
|
|
11
|
+
gem.description = %q{A ruby gem to make units conversion}
|
|
12
|
+
gem.summary = %q{This ruby gem was created to explain the process of ruby gem creation,but this gem can also be used to make units conversion in ruby}
|
|
13
|
+
gem.homepage = ""
|
|
14
|
+
|
|
15
|
+
gem.files = `git ls-files`.split($/)
|
|
16
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
|
17
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
|
18
|
+
gem.require_paths = ["lib"]
|
|
19
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: simple_converter
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
hash: 29
|
|
5
|
+
prerelease:
|
|
6
|
+
segments:
|
|
7
|
+
- 0
|
|
8
|
+
- 0
|
|
9
|
+
- 1
|
|
10
|
+
version: 0.0.1
|
|
11
|
+
platform: ruby
|
|
12
|
+
authors:
|
|
13
|
+
- Srinivas Prabhu Ramanna
|
|
14
|
+
autorequire:
|
|
15
|
+
bindir: bin
|
|
16
|
+
cert_chain: []
|
|
17
|
+
|
|
18
|
+
date: 2013-03-25 00:00:00 Z
|
|
19
|
+
dependencies: []
|
|
20
|
+
|
|
21
|
+
description: A ruby gem to make units conversion
|
|
22
|
+
email: Srinivas.prabhur@gmail.com
|
|
23
|
+
executables: []
|
|
24
|
+
|
|
25
|
+
extensions: []
|
|
26
|
+
|
|
27
|
+
extra_rdoc_files: []
|
|
28
|
+
|
|
29
|
+
files:
|
|
30
|
+
- .gitignore
|
|
31
|
+
- Gemfile
|
|
32
|
+
- LICENSE.txt
|
|
33
|
+
- README.md
|
|
34
|
+
- Rakefile
|
|
35
|
+
- lib/simple_converter.rb
|
|
36
|
+
- lib/simple_converter/version.rb
|
|
37
|
+
- simple_converter.gemspec
|
|
38
|
+
homepage: ""
|
|
39
|
+
licenses: []
|
|
40
|
+
|
|
41
|
+
post_install_message:
|
|
42
|
+
rdoc_options: []
|
|
43
|
+
|
|
44
|
+
require_paths:
|
|
45
|
+
- lib
|
|
46
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
47
|
+
none: false
|
|
48
|
+
requirements:
|
|
49
|
+
- - ">="
|
|
50
|
+
- !ruby/object:Gem::Version
|
|
51
|
+
hash: 3
|
|
52
|
+
segments:
|
|
53
|
+
- 0
|
|
54
|
+
version: "0"
|
|
55
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
56
|
+
none: false
|
|
57
|
+
requirements:
|
|
58
|
+
- - ">="
|
|
59
|
+
- !ruby/object:Gem::Version
|
|
60
|
+
hash: 3
|
|
61
|
+
segments:
|
|
62
|
+
- 0
|
|
63
|
+
version: "0"
|
|
64
|
+
requirements: []
|
|
65
|
+
|
|
66
|
+
rubyforge_project:
|
|
67
|
+
rubygems_version: 1.8.25
|
|
68
|
+
signing_key:
|
|
69
|
+
specification_version: 3
|
|
70
|
+
summary: This ruby gem was created to explain the process of ruby gem creation,but this gem can also be used to make units conversion in ruby
|
|
71
|
+
test_files: []
|
|
72
|
+
|