unite 1.0.2 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. data/Gemfile +1 -1
  2. data/Gemfile.lock +1 -1
  3. data/README +3 -0
  4. data/lib/{unity → unite}/arithmetic.rb +1 -1
  5. data/lib/{unity → unite}/comparison.rb +1 -1
  6. data/lib/{unity → unite}/conversion.rb +1 -1
  7. data/lib/{unity → unite}/dimension/integer.rb +1 -1
  8. data/lib/{unity → unite}/dimension/vector.rb +2 -2
  9. data/lib/{unity → unite}/dimension.rb +3 -3
  10. data/lib/{unity → unite}/fraction.rb +1 -1
  11. data/lib/{unity → unite}/lookup/definitions.rb +1 -1
  12. data/lib/{unity → unite}/lookup/derived_unit.rb +1 -1
  13. data/lib/{unity → unite}/lookup/property.rb +1 -1
  14. data/lib/{unity → unite}/lookup/simple_unit.rb +1 -1
  15. data/lib/{unity → unite}/lookup.rb +4 -4
  16. data/lib/{unity → unite}/quantity.rb +1 -1
  17. data/lib/unite/version.rb +3 -0
  18. data/lib/unite.rb +20 -0
  19. data/spec/arithmetic_spec.rb +1 -1
  20. data/spec/comparison_spec.rb +1 -1
  21. data/spec/conversion_spec.rb +1 -1
  22. data/spec/dimension/integer_spec.rb +1 -1
  23. data/spec/dimension/vector_spec.rb +1 -1
  24. data/spec/dimension_spec.rb +1 -1
  25. data/spec/fabricators/unit_fabricator.rb +4 -4
  26. data/spec/fraction_spec.rb +1 -1
  27. data/spec/lookup/derived_unit_spec.rb +2 -2
  28. data/spec/lookup/property_spec.rb +2 -2
  29. data/spec/lookup/simple_unit_spec.rb +2 -2
  30. data/spec/lookup_spec.rb +1 -1
  31. data/spec/quantity_spec.rb +1 -1
  32. data/spec/spec_helper.rb +1 -1
  33. data/spec/support/shared_examples/units/arithmetic.rb +2 -2
  34. data/spec/support/shared_examples/units/comparison.rb +1 -1
  35. data/spec/support/shared_examples/units/dimension/integer.rb +1 -1
  36. data/spec/support/shared_examples/units/fractions.rb +1 -1
  37. data/unite.gemspec +4 -4
  38. metadata +23 -23
  39. data/lib/unity/version.rb +0 -3
  40. data/lib/unity.rb +0 -20
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
1
  source "http://rubygems.org"
2
2
 
3
- # Specify your gem's dependencies in unity.gemspec
3
+ # Specify your gem's dependencies in unite.gemspec
4
4
  gemspec
5
5
 
6
6
  group :test do
data/Gemfile.lock CHANGED
@@ -8,7 +8,7 @@ GIT
8
8
  PATH
9
9
  remote: .
10
10
  specs:
11
- unite (1.0.1)
11
+ unite (1.1.0)
12
12
  activemodel (>= 3.0.0)
13
13
  activesupport (>= 3.0.0)
14
14
 
data/README CHANGED
@@ -0,0 +1,3 @@
1
+ gem install unite
2
+
3
+ gem 'unite'
@@ -1,5 +1,5 @@
1
1
  # -*- encoding : utf-8 -*-
2
- module Unity
2
+ module Unite
3
3
  module Arithmetic
4
4
 
5
5
  extend ::ActiveSupport::Concern
@@ -1,5 +1,5 @@
1
1
  # -*- encoding : utf-8 -*-
2
- module Unity
2
+ module Unite
3
3
  class IncompatibleError < RuntimeError
4
4
  end
5
5
 
@@ -1,5 +1,5 @@
1
1
  # -*- encoding : utf-8 -*-
2
- module Unity
2
+ module Unite
3
3
  class IncompatibleError < RuntimeError
4
4
  end
5
5
 
@@ -1,5 +1,5 @@
1
1
  # -*- encoding : utf-8 -*-
2
- module Unity
2
+ module Unite
3
3
  module Dimension
4
4
  module Integer
5
5
  extend ::ActiveSupport::Concern
@@ -1,9 +1,9 @@
1
1
  # -*- encoding : utf-8 -*-
2
- module Unity
2
+ module Unite
3
3
  module Dimension
4
4
  module Vector
5
5
  extend ::ActiveSupport::Concern
6
- include Unity::Fraction
6
+ include Unite::Fraction
7
7
 
8
8
  included do
9
9
  end
@@ -1,5 +1,5 @@
1
1
  # -*- encoding : utf-8 -*-
2
- module Unity
2
+ module Unite
3
3
  module Dimension
4
4
  extend self
5
5
 
@@ -32,6 +32,6 @@ module Unity
32
32
  end
33
33
  end
34
34
 
35
- require 'unity/dimension/integer'
36
- require 'unity/dimension/vector'
35
+ require 'unite/dimension/integer'
36
+ require 'unite/dimension/vector'
37
37
 
@@ -1,5 +1,5 @@
1
1
  # -*- encoding : utf-8 -*-
2
- module Unity
2
+ module Unite
3
3
  class InvalidFormat < RuntimeError
4
4
  end
5
5
 
@@ -1,6 +1,6 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
 
3
- module Unity
3
+ module Unite
4
4
 
5
5
  Lookup.clear!
6
6
 
@@ -1,5 +1,5 @@
1
1
  # -*- encoding : utf-8 -*-
2
- module Unity
2
+ module Unite
3
3
  class DerivedUnit
4
4
 
5
5
  include ActiveModel::Validations
@@ -1,5 +1,5 @@
1
1
  # -*- encoding : utf-8 -*-
2
- module Unity
2
+ module Unite
3
3
  class Property
4
4
 
5
5
  include ActiveModel::Validations
@@ -1,5 +1,5 @@
1
1
  # -*- encoding : utf-8 -*-
2
- module Unity
2
+ module Unite
3
3
  class SimpleUnit
4
4
 
5
5
  include ActiveModel::Validations
@@ -1,11 +1,11 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  require 'active_model'
3
- require 'unity/lookup/simple_unit'
4
- require 'unity/lookup/derived_unit'
5
- require 'unity/lookup/property'
3
+ require 'unite/lookup/simple_unit'
4
+ require 'unite/lookup/derived_unit'
5
+ require 'unite/lookup/property'
6
6
  require 'securerandom'
7
7
 
8
- module Unity
8
+ module Unite
9
9
  class Lookup
10
10
 
11
11
  class Invalid < RuntimeError
@@ -1,5 +1,5 @@
1
1
  # -*- encoding : utf-8 -*-
2
- module Unity
2
+ module Unite
3
3
  class Quantity
4
4
 
5
5
  include Dimension::Vector
@@ -0,0 +1,3 @@
1
+ module Unite
2
+ VERSION = "1.1.0"
3
+ end
data/lib/unite.rb ADDED
@@ -0,0 +1,20 @@
1
+ require "unite/version"
2
+
3
+ module Unite
4
+
5
+ end
6
+
7
+
8
+ require 'active_support'
9
+
10
+ # Dir["#{Rails.root.to_s}/lib/units/**/*.rb"].each {|file| require file }
11
+ require 'unite/fraction'
12
+ require 'unite/dimension'
13
+ require 'unite/comparison'
14
+ require 'unite/conversion'
15
+ require 'unite/arithmetic'
16
+
17
+
18
+ require 'unite/lookup'
19
+
20
+ require "unite/quantity"
@@ -1,6 +1,6 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  require 'spec_helper'
3
3
 
4
- describe Unity::Arithmetic do
4
+ describe Unite::Arithmetic do
5
5
 
6
6
  end
@@ -1,6 +1,6 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  require 'spec_helper'
3
3
 
4
- describe Unity::Comparison do
4
+ describe Unite::Comparison do
5
5
 
6
6
  end
@@ -1,7 +1,7 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  require 'spec_helper'
3
3
 
4
- describe Unity::Conversion do
4
+ describe Unite::Conversion do
5
5
 
6
6
  end
7
7
 
@@ -1,7 +1,7 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  require 'spec_helper'
3
3
 
4
- describe Unity::Dimension::Integer do
4
+ describe Unite::Dimension::Integer do
5
5
 
6
6
  end
7
7
 
@@ -1,7 +1,7 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  require 'spec_helper'
3
3
 
4
- describe Unity::Dimension::Vector do
4
+ describe Unite::Dimension::Vector do
5
5
 
6
6
  end
7
7
 
@@ -1,7 +1,7 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  require 'spec_helper'
3
3
 
4
- describe Unity::Dimension do
4
+ describe Unite::Dimension do
5
5
 
6
6
 
7
7
  end
@@ -1,14 +1,14 @@
1
1
  # -*- encoding : utf-8 -*-
2
- require 'unity/lookup/simple_unit'
3
- require 'unity/lookup/derived_unit'
2
+ require 'unite/lookup/simple_unit'
3
+ require 'unite/lookup/derived_unit'
4
4
 
5
- Fabricator(:simple_unit, :class_name => "Unity::SimpleUnit") do
5
+ Fabricator(:simple_unit, :class_name => "Unite::SimpleUnit") do
6
6
  si_factor 1000.0
7
7
  name 'km'
8
8
  dimension :length
9
9
  end
10
10
 
11
- Fabricator(:derived_unit, :class_name => "Unity::DerivedUnit") do
11
+ Fabricator(:derived_unit, :class_name => "Unite::DerivedUnit") do
12
12
  name 'kWh'
13
13
  end
14
14
 
@@ -1,7 +1,7 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  require 'spec_helper'
3
3
 
4
- describe Unity::Fraction do
4
+ describe Unite::Fraction do
5
5
 
6
6
 
7
7
  end
@@ -1,8 +1,8 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  require 'spec_helper'
3
- require 'unity/lookup/derived_unit.rb'
3
+ require 'unite/lookup/derived_unit.rb'
4
4
 
5
- module Unity
5
+ module Unite
6
6
  describe DerivedUnit do
7
7
  it { should validate_presence_of(:name)}
8
8
 
@@ -1,8 +1,8 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  require 'spec_helper'
3
- require 'unity/lookup/property.rb'
3
+ require 'unite/lookup/property.rb'
4
4
 
5
- module Unity
5
+ module Unite
6
6
  describe Property do
7
7
  it { should validate_presence_of(:name)}
8
8
 
@@ -1,8 +1,8 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  require 'spec_helper'
3
- require 'unity/lookup/simple_unit.rb'
3
+ require 'unite/lookup/simple_unit.rb'
4
4
 
5
- module Unity
5
+ module Unite
6
6
  describe SimpleUnit do
7
7
  it { should ensure_inclusion_of(:dimension).in_array(Dimension::LIST) }
8
8
  it { should validate_presence_of(:si_factor)}
data/spec/lookup_spec.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  require 'spec_helper'
3
3
 
4
- module Unity
4
+ module Unite
5
5
  describe Lookup do
6
6
  subject { Lookup }
7
7
 
@@ -1,7 +1,7 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  require 'spec_helper'
3
3
 
4
- module Unity
4
+ module Unite
5
5
  describe Quantity do
6
6
 
7
7
  subject { Quantity.new :expression => expression }
data/spec/spec_helper.rb CHANGED
@@ -7,7 +7,7 @@ $LOAD_PATH.unshift(File.dirname(__FILE__))
7
7
  require 'rspec'
8
8
  require 'shoulda/matchers/active_model'
9
9
  require 'mocha'
10
- require 'unity'
10
+ require 'unite'
11
11
  require 'fabrication'
12
12
 
13
13
  # Requires supporting files with custom matchers and macros, etc,
@@ -113,10 +113,10 @@ shared_examples "unit arithmetic" do
113
113
  include_examples "division operation"
114
114
 
115
115
  it "should raise error for subtraction" do
116
- lambda { object1 - object2 }.should raise_exception Unity::IncompatibleError
116
+ lambda { object1 - object2 }.should raise_exception Unite::IncompatibleError
117
117
  end
118
118
  it "should raise error for addition" do
119
- lambda { object1 + object2 }.should raise_exception Unity::IncompatibleError
119
+ lambda { object1 + object2 }.should raise_exception Unite::IncompatibleError
120
120
  end
121
121
 
122
122
  end
@@ -38,7 +38,7 @@ shared_examples_for "comparable unit" do
38
38
  let(:expression2) { "g" }
39
39
 
40
40
  it "should raise exception" do
41
- lambda { subject }.should raise_exception Unity::IncompatibleError
41
+ lambda { subject }.should raise_exception Unite::IncompatibleError
42
42
  end
43
43
  end
44
44
  end
@@ -15,7 +15,7 @@ shared_examples "dimension integer" do
15
15
  let(:property_stub) { stub }
16
16
  before do
17
17
  subject.stubs(:dimension_int => dimension_int)
18
- Unity::Lookup.stubs(:find_property).with(dimension_int).returns(property_stub)
18
+ Unite::Lookup.stubs(:find_property).with(dimension_int).returns(property_stub)
19
19
  end
20
20
  its(:property) { should == property_stub }
21
21
  end
@@ -58,7 +58,7 @@ shared_examples_for "unit fractions" do
58
58
  context 'with invalid format' do
59
59
  let(:expression) { 'km/kg/s' }
60
60
  it "should raise exception" do
61
- lambda { subject }.should raise_exception Unity::InvalidFormat
61
+ lambda { subject }.should raise_exception Unite::InvalidFormat
62
62
  end
63
63
  end
64
64
 
data/unite.gemspec CHANGED
@@ -1,17 +1,17 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  $:.push File.expand_path("../lib", __FILE__)
3
- require "unity/version"
3
+ require "unite/version"
4
4
 
5
5
  Gem::Specification.new do |s|
6
6
  s.name = "unite"
7
- s.version = Unity::VERSION
7
+ s.version = Unite::VERSION
8
8
  s.authors = ["stellard"]
9
9
  s.email = ["scott.ellard@gmail.com"]
10
- s.homepage = "https://github.com/stellard/unity"
10
+ s.homepage = "https://github.com/stellard/unite"
11
11
  s.summary = %q{Unite provides extensions to your objects to support values with units}
12
12
  s.description = %q{Unite provides extensions to your objects to support values with units}
13
13
 
14
- s.rubyforge_project = "unity"
14
+ s.rubyforge_project = "unite"
15
15
 
16
16
  s.files = `git ls-files`.split("\n")
17
17
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unite
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-11 00:00:00.000000000 Z
12
+ date: 2012-05-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
16
- requirement: &70246031750180 !ruby/object:Gem::Requirement
16
+ requirement: &70273965523040 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 3.0.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70246031750180
24
+ version_requirements: *70273965523040
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: activemodel
27
- requirement: &70246031728160 !ruby/object:Gem::Requirement
27
+ requirement: &70273965500980 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: 3.0.0
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70246031728160
35
+ version_requirements: *70273965500980
36
36
  description: Unite provides extensions to your objects to support values with units
37
37
  email:
38
38
  - scott.ellard@gmail.com
@@ -48,21 +48,21 @@ files:
48
48
  - MIT-LICENSE
49
49
  - README
50
50
  - Rakefile
51
- - lib/unity.rb
52
- - lib/unity/arithmetic.rb
53
- - lib/unity/comparison.rb
54
- - lib/unity/conversion.rb
55
- - lib/unity/dimension.rb
56
- - lib/unity/dimension/integer.rb
57
- - lib/unity/dimension/vector.rb
58
- - lib/unity/fraction.rb
59
- - lib/unity/lookup.rb
60
- - lib/unity/lookup/definitions.rb
61
- - lib/unity/lookup/derived_unit.rb
62
- - lib/unity/lookup/property.rb
63
- - lib/unity/lookup/simple_unit.rb
64
- - lib/unity/quantity.rb
65
- - lib/unity/version.rb
51
+ - lib/unite.rb
52
+ - lib/unite/arithmetic.rb
53
+ - lib/unite/comparison.rb
54
+ - lib/unite/conversion.rb
55
+ - lib/unite/dimension.rb
56
+ - lib/unite/dimension/integer.rb
57
+ - lib/unite/dimension/vector.rb
58
+ - lib/unite/fraction.rb
59
+ - lib/unite/lookup.rb
60
+ - lib/unite/lookup/definitions.rb
61
+ - lib/unite/lookup/derived_unit.rb
62
+ - lib/unite/lookup/property.rb
63
+ - lib/unite/lookup/simple_unit.rb
64
+ - lib/unite/quantity.rb
65
+ - lib/unite/version.rb
66
66
  - spec/arithmetic_spec.rb
67
67
  - spec/comparison_spec.rb
68
68
  - spec/conversion_spec.rb
@@ -85,7 +85,7 @@ files:
85
85
  - spec/support/shared_examples/units/dimension/vector.rb
86
86
  - spec/support/shared_examples/units/fractions.rb
87
87
  - unite.gemspec
88
- homepage: https://github.com/stellard/unity
88
+ homepage: https://github.com/stellard/unite
89
89
  licenses: []
90
90
  post_install_message:
91
91
  rdoc_options: []
@@ -104,7 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
104
104
  - !ruby/object:Gem::Version
105
105
  version: '0'
106
106
  requirements: []
107
- rubyforge_project: unity
107
+ rubyforge_project: unite
108
108
  rubygems_version: 1.8.6
109
109
  signing_key:
110
110
  specification_version: 3
data/lib/unity/version.rb DELETED
@@ -1,3 +0,0 @@
1
- module Unity
2
- VERSION = "1.0.2"
3
- end
data/lib/unity.rb DELETED
@@ -1,20 +0,0 @@
1
- require "unity/version"
2
-
3
- module Unity
4
-
5
- end
6
-
7
-
8
- require 'active_support'
9
-
10
- # Dir["#{Rails.root.to_s}/lib/units/**/*.rb"].each {|file| require file }
11
- require 'unity/fraction'
12
- require 'unity/dimension'
13
- require 'unity/comparison'
14
- require 'unity/conversion'
15
- require 'unity/arithmetic'
16
-
17
-
18
- require 'unity/lookup'
19
-
20
- require "unity/quantity"