alchemist 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/Rakefile +1 -1
  2. data/lib/alchemist.rb +6 -0
  3. metadata +2 -2
data/Rakefile CHANGED
@@ -6,7 +6,7 @@ PKG_FILES = %w(Rakefile) +
6
6
 
7
7
  gem_spec = Gem::Specification.new do |gem_spec|
8
8
  gem_spec.name = 'alchemist'
9
- gem_spec.version = '0.0.5'
9
+ gem_spec.version = '0.0.6'
10
10
  gem_spec.summary = 'Conversions... like you\'ve never seen them before!'
11
11
  gem_spec.description = 'Conversions... like you\'ve never seen them before!!'
12
12
  gem_spec.email = 'matt@toastyapps.com'
data/lib/alchemist.rb CHANGED
@@ -323,6 +323,8 @@ module Alchemist
323
323
  end
324
324
 
325
325
  class NumericConversion
326
+ include Comparable
327
+
326
328
  def to(type = nil)
327
329
  unless type
328
330
  self
@@ -348,6 +350,10 @@ module Alchemist
348
350
  @value
349
351
  end
350
352
 
353
+ def <=>(other)
354
+ (self.to_f * @exponent) <=> other.to(@unit_name).to_f
355
+ end
356
+
351
357
  private
352
358
  def initialize value, unit_name, exponent = 1.0
353
359
  @value = value.to_f
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alchemist
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Mongeau
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-10-27 00:00:00 -04:00
12
+ date: 2009-11-06 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies: []
15
15