simplificator-conversions 0.3.0 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/simplificator-conversions.rb +3 -9
- data/simplificator-conversions.gemspec +54 -0
- data/test/test_helper.rb +1 -1
- metadata +3 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.2
|
@@ -1,6 +1,4 @@
|
|
1
1
|
module UnitConversions
|
2
|
-
UNITS = ['kg', 'g', 't', 'mm2', 'm2']
|
3
|
-
CONVERT_TO_PATTERN = /(#{UNITS.join('|')})_to_(#{UNITS.join('|')})/
|
4
2
|
CONVERSIONS = {
|
5
3
|
'kg' => {
|
6
4
|
't' => lambda() {|kg| kg / 1000.0 },
|
@@ -21,6 +19,8 @@ module UnitConversions
|
|
21
19
|
'm2' => lambda() {|mm2| mm2 / (1000 * 1000.0)},
|
22
20
|
},
|
23
21
|
}
|
22
|
+
UNITS = CONVERSIONS.keys
|
23
|
+
CONVERT_TO_PATTERN = /(#{UNITS.join('|')})_to_(#{UNITS.join('|')})/
|
24
24
|
|
25
25
|
|
26
26
|
def method_missing_with_unit_conversions(m, *args)
|
@@ -33,13 +33,7 @@ module UnitConversions
|
|
33
33
|
|
34
34
|
end
|
35
35
|
|
36
|
-
class
|
37
|
-
include UnitConversions
|
38
|
-
alias :method_missing_without_unit_conversions :method_missing
|
39
|
-
alias :method_missing :method_missing_with_unit_conversions
|
40
|
-
end
|
41
|
-
|
42
|
-
class Float
|
36
|
+
class Numeric
|
43
37
|
include UnitConversions
|
44
38
|
alias :method_missing_without_unit_conversions :method_missing
|
45
39
|
alias :method_missing :method_missing_with_unit_conversions
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{simplificator-conversions}
|
8
|
+
s.version = "0.3.2"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["simplificator"]
|
12
|
+
s.date = %q{2010-02-15}
|
13
|
+
s.description = %q{adds conversion methods to numbers}
|
14
|
+
s.email = %q{pascal.betz@simplificator.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
".gitignore",
|
22
|
+
"LICENSE",
|
23
|
+
"README.rdoc",
|
24
|
+
"Rakefile",
|
25
|
+
"VERSION",
|
26
|
+
"lib/simplificator-conversions.rb",
|
27
|
+
"lib/simplificator-conversions.rb",
|
28
|
+
"simplificator-conversions.gemspec",
|
29
|
+
"test/conversions_test.rb",
|
30
|
+
"test/test_helper.rb"
|
31
|
+
]
|
32
|
+
s.homepage = %q{http://github.com/simplficator/conversions}
|
33
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
34
|
+
s.require_paths = ["lib"]
|
35
|
+
s.rubygems_version = %q{1.3.5}
|
36
|
+
s.summary = %q{adds conversion methods to numbers}
|
37
|
+
s.test_files = [
|
38
|
+
"test/conversions_test.rb",
|
39
|
+
"test/test_helper.rb"
|
40
|
+
]
|
41
|
+
|
42
|
+
if s.respond_to? :specification_version then
|
43
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
44
|
+
s.specification_version = 3
|
45
|
+
|
46
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
47
|
+
s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
48
|
+
else
|
49
|
+
s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
50
|
+
end
|
51
|
+
else
|
52
|
+
s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
53
|
+
end
|
54
|
+
end
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simplificator-conversions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- simplificator
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2010-02-15 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -39,6 +39,7 @@ files:
|
|
39
39
|
- Rakefile
|
40
40
|
- VERSION
|
41
41
|
- lib/simplificator-conversions.rb
|
42
|
+
- simplificator-conversions.gemspec
|
42
43
|
- test/conversions_test.rb
|
43
44
|
- test/test_helper.rb
|
44
45
|
has_rdoc: true
|