m9t 0.2.3 → 0.3.0
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/GPL-LICENSE.txt +674 -0
- data/Gemfile +3 -0
- data/MIT-LICENSE.txt +7 -0
- data/README.md +100 -0
- data/Rakefile +9 -14
- data/lib/m9t/base.rb +3 -3
- data/lib/m9t/distance.rb +3 -3
- data/lib/m9t/pressure.rb +4 -4
- data/lib/m9t/speed.rb +3 -4
- data/lib/m9t/version.rb +2 -2
- data/locales/it.yml +1 -1
- data/m9t.gemspec +29 -0
- data/test/base_test.rb +55 -0
- data/test/direction_test.rb +10 -7
- data/test/distance_test.rb +1 -4
- data/test/i18n_test.rb +2 -5
- data/test/pressure_test.rb +1 -4
- data/test/speed_test.rb +3 -6
- data/test/temperature_test.rb +6 -5
- data/test/test_helper.rb +17 -0
- metadata +97 -38
- data/COPYING +0 -20
- data/README.rdoc +0 -62
- data/test/test_all.rb +0 -3
data/test/test_helper.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems' if RUBY_VERSION < '1.9'
|
4
|
+
require 'test/unit'
|
5
|
+
|
6
|
+
if RUBY_VERSION > '1.9'
|
7
|
+
require 'simplecov'
|
8
|
+
if ENV[ 'COVERAGE' ]
|
9
|
+
SimpleCov.start do
|
10
|
+
add_filter "/test/"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
$:.unshift( File.expand_path( '../lib', File.dirname(__FILE__) ) )
|
16
|
+
|
17
|
+
require 'm9t'
|
metadata
CHANGED
@@ -1,37 +1,81 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: m9t
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 3
|
9
|
+
- 0
|
10
|
+
version: 0.3.0
|
6
11
|
platform: ruby
|
7
|
-
authors:
|
12
|
+
authors:
|
8
13
|
- Joe Yates
|
9
14
|
autorequire:
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
dependencies:
|
15
|
-
- !ruby/object:Gem::Dependency
|
17
|
+
|
18
|
+
date: 2012-01-14 00:00:00 Z
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: rake
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 3
|
29
|
+
segments:
|
30
|
+
- 0
|
31
|
+
version: "0"
|
32
|
+
type: :runtime
|
33
|
+
version_requirements: *id001
|
34
|
+
- !ruby/object:Gem::Dependency
|
16
35
|
name: i18n
|
17
|
-
|
36
|
+
prerelease: false
|
37
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
18
38
|
none: false
|
19
|
-
requirements:
|
20
|
-
- -
|
21
|
-
- !ruby/object:Gem::Version
|
39
|
+
requirements:
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
hash: 25
|
43
|
+
segments:
|
44
|
+
- 0
|
45
|
+
- 3
|
46
|
+
- 5
|
22
47
|
version: 0.3.5
|
23
48
|
type: :runtime
|
49
|
+
version_requirements: *id002
|
50
|
+
- !ruby/object:Gem::Dependency
|
51
|
+
name: rcov
|
24
52
|
prerelease: false
|
25
|
-
|
26
|
-
|
53
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
54
|
+
none: false
|
55
|
+
requirements:
|
56
|
+
- - ">="
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
hash: 3
|
59
|
+
segments:
|
60
|
+
- 0
|
61
|
+
version: "0"
|
62
|
+
type: :development
|
63
|
+
version_requirements: *id003
|
64
|
+
description: "Classes for handling basic measurement units: distance, direction, speed, temperature and pressure"
|
27
65
|
email: joe.g.yates@gmail.com
|
28
66
|
executables: []
|
67
|
+
|
29
68
|
extensions: []
|
69
|
+
|
30
70
|
extra_rdoc_files: []
|
31
|
-
|
32
|
-
|
33
|
-
-
|
71
|
+
|
72
|
+
files:
|
73
|
+
- GPL-LICENSE.txt
|
74
|
+
- Gemfile
|
75
|
+
- MIT-LICENSE.txt
|
76
|
+
- README.md
|
34
77
|
- Rakefile
|
78
|
+
- lib/m9t.rb
|
35
79
|
- lib/m9t/base.rb
|
36
80
|
- lib/m9t/direction.rb
|
37
81
|
- lib/m9t/distance.rb
|
@@ -40,40 +84,55 @@ files:
|
|
40
84
|
- lib/m9t/speed.rb
|
41
85
|
- lib/m9t/temperature.rb
|
42
86
|
- lib/m9t/version.rb
|
43
|
-
-
|
87
|
+
- locales/en.yml
|
88
|
+
- locales/it.yml
|
89
|
+
- m9t.gemspec
|
90
|
+
- test/base_test.rb
|
44
91
|
- test/direction_test.rb
|
45
92
|
- test/distance_test.rb
|
46
93
|
- test/i18n_test.rb
|
47
94
|
- test/pressure_test.rb
|
48
95
|
- test/speed_test.rb
|
49
96
|
- test/temperature_test.rb
|
50
|
-
- test/
|
51
|
-
|
52
|
-
- locales/it.yml
|
53
|
-
has_rdoc: true
|
54
|
-
homepage: http://github.com/joeyates/m9t
|
97
|
+
- test/test_helper.rb
|
98
|
+
homepage: https://github.com/joeyates/m9t
|
55
99
|
licenses: []
|
100
|
+
|
56
101
|
post_install_message:
|
57
102
|
rdoc_options: []
|
58
|
-
|
103
|
+
|
104
|
+
require_paths:
|
59
105
|
- lib
|
60
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
106
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
61
107
|
none: false
|
62
|
-
requirements:
|
63
|
-
- -
|
64
|
-
- !ruby/object:Gem::Version
|
65
|
-
|
66
|
-
|
108
|
+
requirements:
|
109
|
+
- - ">="
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
hash: 3
|
112
|
+
segments:
|
113
|
+
- 0
|
114
|
+
version: "0"
|
115
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
67
116
|
none: false
|
68
|
-
requirements:
|
69
|
-
- -
|
70
|
-
- !ruby/object:Gem::Version
|
71
|
-
|
117
|
+
requirements:
|
118
|
+
- - ">="
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
hash: 3
|
121
|
+
segments:
|
122
|
+
- 0
|
123
|
+
version: "0"
|
72
124
|
requirements: []
|
125
|
+
|
73
126
|
rubyforge_project: nowarning
|
74
|
-
rubygems_version: 1.
|
127
|
+
rubygems_version: 1.8.10
|
75
128
|
signing_key:
|
76
129
|
specification_version: 3
|
77
|
-
summary:
|
78
|
-
test_files:
|
79
|
-
- test/
|
130
|
+
summary: Measurements and conversions library for Ruby
|
131
|
+
test_files:
|
132
|
+
- test/base_test.rb
|
133
|
+
- test/direction_test.rb
|
134
|
+
- test/distance_test.rb
|
135
|
+
- test/i18n_test.rb
|
136
|
+
- test/pressure_test.rb
|
137
|
+
- test/speed_test.rb
|
138
|
+
- test/temperature_test.rb
|
data/COPYING
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
Copyright (c) 2010 Joe Yates
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
-
a copy of this software and associated documentation files (the
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
9
|
-
the following conditions:
|
10
|
-
|
11
|
-
The above copyright notice and this permission notice shall be
|
12
|
-
included in all copies or substantial portions of the Software.
|
13
|
-
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
DELETED
@@ -1,62 +0,0 @@
|
|
1
|
-
== m9t - Various units of measurement
|
2
|
-
|
3
|
-
This package handles the basic units of measure:
|
4
|
-
* distance,
|
5
|
-
* direction,
|
6
|
-
* speed,
|
7
|
-
* temperature,
|
8
|
-
* weight.
|
9
|
-
|
10
|
-
The emphasis is on:
|
11
|
-
* coherent interface,
|
12
|
-
* ease of translation (using i18n).
|
13
|
-
|
14
|
-
== Internals
|
15
|
-
|
16
|
-
Internally, values are stored in SI units, with the exception of temperature:
|
17
|
-
* distance - meters,
|
18
|
-
* direction - degrees,
|
19
|
-
* speed - meters per second,
|
20
|
-
* temperature - degrees celcius,
|
21
|
-
* weight - kilograms.
|
22
|
-
|
23
|
-
== Interface
|
24
|
-
|
25
|
-
new: accepts the S.I. unit as a parameter:
|
26
|
-
|
27
|
-
height = M9t::Distance.new(1.75)
|
28
|
-
|
29
|
-
to_f: returns the decimal value(s):
|
30
|
-
|
31
|
-
height.to_f -> 1.75
|
32
|
-
|
33
|
-
other units:
|
34
|
-
there are class methods named after each known unit,
|
35
|
-
which take values in that unit
|
36
|
-
(actually, they are defined as needed):
|
37
|
-
|
38
|
-
marathon = M9t::Distance.miles(26.21875)
|
39
|
-
marathon.to_f -> 42194.988
|
40
|
-
|
41
|
-
to_s: returns a localized string with units:
|
42
|
-
|
43
|
-
I18n.locale = :it
|
44
|
-
puts M9t::Distance.new(3).to_s -> '3 metri'
|
45
|
-
|
46
|
-
=== Class methods for conversion
|
47
|
-
|
48
|
-
Methods are available for conversion between any pair of units:
|
49
|
-
|
50
|
-
M9t::Distance.miles_to_meters(26.21875) -> 42194.988
|
51
|
-
|
52
|
-
== Other Software
|
53
|
-
|
54
|
-
* ruby-units
|
55
|
-
* Doesn't handle i18n:
|
56
|
-
* The library depends heavily on English string representations of units.
|
57
|
-
* Monkey patches a lot of core classes:
|
58
|
-
* Adds methods to e.g. Object.
|
59
|
-
|
60
|
-
== License
|
61
|
-
|
62
|
-
MIT License. See the included COPYING file.
|
data/test/test_all.rb
DELETED