Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Created repository.

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