Skip to content
This repository
Browse code

Created repository.

  • Loading branch information...
commit 27c2eaf0a8d7150a4c9e69d6996784ef97599ce0 0 parents
Arto Bendiken authored December 29, 2009
33  .gemspec
... ...
@@ -0,0 +1,33 @@
  1
+#!/usr/bin/env ruby -rubygems
  2
+# -*- encoding: utf-8 -*-
  3
+
  4
+GEMSPEC = Gem::Specification.new do |gem|
  5
+  gem.version            = File.read('VERSION').chomp
  6
+  gem.date               = File.mtime('VERSION').strftime('%Y-%m-%d')
  7
+
  8
+  gem.name               = 'quantity'
  9
+  gem.homepage           = 'http://quantity.rubyforge.org/'
  10
+  gem.license            = 'Public Domain' if gem.respond_to?(:license=)
  11
+  gem.summary            = '...'
  12
+  gem.description        = '...'
  13
+  gem.rubyforge_project  = 'quantity'
  14
+
  15
+  gem.authors            = ['Ben Lavender', 'Arto Bendiken']
  16
+  gem.email              = 'blavender@gmail.com'
  17
+
  18
+  gem.platform           = Gem::Platform::RUBY
  19
+  gem.files              = %w(AUTHORS README UNLICENSE VERSION) + Dir.glob('lib/**/*.rb')
  20
+  gem.bindir             = %q(bin)
  21
+  gem.executables        = %w()
  22
+  gem.default_executable = gem.executables.first
  23
+  gem.require_paths      = %w(lib)
  24
+  gem.extensions         = %w()
  25
+  gem.test_files         = %w()
  26
+  gem.has_rdoc           = false
  27
+
  28
+  gem.required_ruby_version      = '>= 1.8.2'
  29
+  gem.requirements               = []
  30
+  gem.add_development_dependency 'rspec', '>= 1.2.9'
  31
+  gem.add_development_dependency 'yard' , '>= 0.5.2'
  32
+  gem.post_install_message       = nil
  33
+end
5  .gitignore
... ...
@@ -0,0 +1,5 @@
  1
+.DS_Store
  2
+.tmp
  3
+.yardoc
  4
+pkg
  5
+tmp
0  .yardopts
No changes.
2  AUTHORS
... ...
@@ -0,0 +1,2 @@
  1
+* Ben Lavender <blavender@gmail.com> (Lead developer)
  2
+* Arto Bendiken <arto.bendiken@gmail.com> (Contributions)
1  README
14  README.md
Source Rendered
... ...
@@ -0,0 +1,14 @@
  1
+Quantity.rb: Units and Quantities for Ruby
  2
+==========================================
  3
+
  4
+Authors
  5
+-------
  6
+
  7
+* [Ben Lavender](mailto:blavender@gmail.com) - <http://bhuga.net/>
  8
+* [Arto Bendiken](mailto:arto.bendiken@gmail.com) - <http://ar.to/>
  9
+
  10
+License
  11
+-------
  12
+
  13
+Quantity.rb is free and unencumbered public domain software. For more
  14
+information, see <http://unlicense.org/> or the accompanying UNLICENSE file.
8  Rakefile
... ...
@@ -0,0 +1,8 @@
  1
+#!/usr/bin/env ruby
  2
+$:.unshift(File.expand_path(File.join(File.dirname(__FILE__), 'lib')))
  3
+require 'rubygems'
  4
+begin
  5
+  require 'rakefile' # http://github.com/bendiken/rakefile
  6
+rescue LoadError => e
  7
+end
  8
+require 'quantity'
24  UNLICENSE
... ...
@@ -0,0 +1,24 @@
  1
+This is free and unencumbered software released into the public domain.
  2
+
  3
+Anyone is free to copy, modify, publish, use, compile, sell, or
  4
+distribute this software, either in source code form or as a compiled
  5
+binary, for any purpose, commercial or non-commercial, and by any
  6
+means.
  7
+
  8
+In jurisdictions that recognize copyright laws, the author or authors
  9
+of this software dedicate any and all copyright interest in the
  10
+software to the public domain. We make this dedication for the benefit
  11
+of the public at large and to the detriment of our heirs and
  12
+successors. We intend this dedication to be an overt act of
  13
+relinquishment in perpetuity of all present and future rights to this
  14
+software under copyright law.
  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 NONINFRINGEMENT.
  19
+IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
  20
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  21
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  22
+OTHER DEALINGS IN THE SOFTWARE.
  23
+
  24
+For more information, please refer to <http://unlicense.org/>
1  VERSION
... ...
@@ -0,0 +1 @@
  1
+0.0.0
2  doc/.gitignore
... ...
@@ -0,0 +1,2 @@
  1
+rdoc
  2
+yard
17  lib/quantity.rb
... ...
@@ -0,0 +1,17 @@
  1
+require 'quantity/version'
  2
+
  3
+class Quantity
  4
+  autoload :Unit, 'quantity/unit'
  5
+
  6
+  undef_method *(instance_methods - %w(__id__ __send__ __class__ __eval__ instance_eval inspect))
  7
+
  8
+  attr_reader :value
  9
+  attr_reader :unit
  10
+
  11
+  ##
  12
+  # @param  [Numeric] value
  13
+  # @param  [Unit]    unit
  14
+  def initialize(value, unit)
  15
+    @value, @unit = value, unit
  16
+  end
  17
+end
28  lib/quantity/unit.rb
... ...
@@ -0,0 +1,28 @@
  1
+class Quantity
  2
+  class Unit
  3
+    autoload :Length,      'quantity/unit/length'
  4
+    autoload :Mass,        'quantity/unit/mass'
  5
+    autoload :Time,        'quantity/unit/time'
  6
+    autoload :Current,     'quantity/unit/current'
  7
+    autoload :Temperature, 'quantity/unit/temperature'
  8
+    autoload :Luminosity,  'quantity/unit/luminosity'
  9
+    autoload :Substance,   'quantity/unit/substance'
  10
+
  11
+    # @return [String]
  12
+    attr_reader :name
  13
+
  14
+    alias_method :to_s, :name
  15
+
  16
+    ##
  17
+    # @param  [String] name
  18
+    def initialize(name = nil)
  19
+      @name = name || self.class.name.split(':').last.downcase
  20
+    end
  21
+
  22
+    ##
  23
+    # @return [Symbol]
  24
+    def to_sym
  25
+      name.to_sym
  26
+    end
  27
+  end
  28
+end
9  lib/quantity/unit/current.rb
... ...
@@ -0,0 +1,9 @@
  1
+class Quantity
  2
+  class Unit
  3
+    ##
  4
+    # @see http://en.wikipedia.org/wiki/Electric_current
  5
+    class Current < Unit
  6
+      # TODO
  7
+    end
  8
+  end
  9
+end
9  lib/quantity/unit/length.rb
... ...
@@ -0,0 +1,9 @@
  1
+class Quantity
  2
+  class Unit
  3
+    ##
  4
+    # @see http://en.wikipedia.org/wiki/Length
  5
+    class Length < Unit
  6
+      # TODO
  7
+    end
  8
+  end
  9
+end
9  lib/quantity/unit/luminosity.rb
... ...
@@ -0,0 +1,9 @@
  1
+class Quantity
  2
+  class Unit
  3
+    ##
  4
+    # @see http://en.wikipedia.org/wiki/Luminous_intensity
  5
+    class Luminosity < Unit
  6
+      # TODO
  7
+    end
  8
+  end
  9
+end
9  lib/quantity/unit/mass.rb
... ...
@@ -0,0 +1,9 @@
  1
+class Quantity
  2
+  class Unit
  3
+    ##
  4
+    # @see http://en.wikipedia.org/wiki/Mass
  5
+    class Mass < Unit
  6
+      # TODO
  7
+    end
  8
+  end
  9
+end
9  lib/quantity/unit/substance.rb
... ...
@@ -0,0 +1,9 @@
  1
+class Quantity
  2
+  class Unit
  3
+    ##
  4
+    # @see http://en.wikipedia.org/wiki/Amount_of_substance
  5
+    class Substance < Unit
  6
+      # TODO
  7
+    end
  8
+  end
  9
+end
9  lib/quantity/unit/temperature.rb
... ...
@@ -0,0 +1,9 @@
  1
+class Quantity
  2
+  class Unit
  3
+    ##
  4
+    # @see http://en.wikipedia.org/wiki/Thermodynamic_temperature
  5
+    class Temperature < Unit
  6
+      # TODO
  7
+    end
  8
+  end
  9
+end
9  lib/quantity/unit/time.rb
... ...
@@ -0,0 +1,9 @@
  1
+class Quantity
  2
+  class Unit
  3
+    ##
  4
+    # @see http://en.wikipedia.org/wiki/Time
  5
+    class Time < Unit
  6
+      # TODO
  7
+    end
  8
+  end
  9
+end
19  lib/quantity/version.rb
... ...
@@ -0,0 +1,19 @@
  1
+class Quantity
  2
+  module VERSION
  3
+    MAJOR = 0
  4
+    MINOR = 0
  5
+    TINY  = 0
  6
+    EXTRA = nil
  7
+
  8
+    STRING = [MAJOR, MINOR, TINY].join('.')
  9
+    STRING << "-#{EXTRA}" if EXTRA
  10
+
  11
+    ##
  12
+    # @return [String]
  13
+    def self.to_s()   STRING end
  14
+
  15
+    ##
  16
+    # @return [String]
  17
+    def self.to_str() STRING end
  18
+  end
  19
+end

0 notes on commit 27c2eaf

Please sign in to comment.
Something went wrong with that request. Please try again.