distance 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +21 -0
- data/lib/distance/core_ext/float.rb +7 -0
- data/lib/distance/core_ext/integer.rb +7 -0
- data/lib/distance/core_ext/numeric.rb +13 -0
- data/lib/distance/core_ext.rb +3 -0
- data/lib/distance/version.rb +1 -1
- metadata +5 -2
- data/lib/distance/fixnum_extensions.rb +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5d123ba2ed9a2734083d1cb3d7fd722af9e327f8
|
4
|
+
data.tar.gz: fbf75d9780f99dc8bcf72ab3f3c76514921cfb80
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d7f03ddadf2fc1fee516a4fccdfabfa5182b774dc0cb9ea82697297c794ef9c40446015151543064d91d7df4bb7579f5cb9c10e66f72672ebcdb60ee12e8ee9
|
7
|
+
data.tar.gz: 1fac374e015221e06e6304dc1513058826cf85f7892653288d8f5bf3ef60386c4cb6a1dd556b0609207bdb0381627f55d5cf6e86b9fa466c1b4b638052df260a
|
data/README.md
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
[![Build Status](https://travis-ci.org/tcollier/distance.svg?branch=master)](https://travis-ci.org/tcollier/distance)
|
2
|
+
|
1
3
|
# Distance
|
2
4
|
|
3
5
|
Convenience methods for using distances
|
@@ -70,6 +72,25 @@ Distance.miles(10) <= Distance.kilometers(10)
|
|
70
72
|
# => false
|
71
73
|
```
|
72
74
|
|
75
|
+
### Numeric core extensions
|
76
|
+
|
77
|
+
You can optionally enable core extensions to `Float` and `Integer` by
|
78
|
+
|
79
|
+
```ruby
|
80
|
+
require 'distance/core_ext'
|
81
|
+
```
|
82
|
+
|
83
|
+
This adds the following convenience methods to `Float` and `Integer`
|
84
|
+
|
85
|
+
```ruby
|
86
|
+
26.2.miles
|
87
|
+
# => Distance.miles(26.2)
|
88
|
+
1.kilometer
|
89
|
+
# => Distance.kilometers(1)
|
90
|
+
5 * Distance.new(1000)
|
91
|
+
# => Distance.new(5000)
|
92
|
+
```
|
93
|
+
|
73
94
|
## Development
|
74
95
|
|
75
96
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/lib/distance/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: distance
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Collier
|
@@ -85,7 +85,10 @@ files:
|
|
85
85
|
- bin/setup
|
86
86
|
- distance.gemspec
|
87
87
|
- lib/distance.rb
|
88
|
-
- lib/distance/
|
88
|
+
- lib/distance/core_ext.rb
|
89
|
+
- lib/distance/core_ext/float.rb
|
90
|
+
- lib/distance/core_ext/integer.rb
|
91
|
+
- lib/distance/core_ext/numeric.rb
|
89
92
|
- lib/distance/version.rb
|
90
93
|
homepage: https://github.com/tcollier/distance
|
91
94
|
licenses:
|
@@ -1 +0,0 @@
|
|
1
|
-
require_relative '../core_ext/numeric'
|