auom 0.0.4 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. data/.gitignore +3 -0
  2. data/.travis.yml +4 -4
  3. data/Changelog.md +8 -0
  4. data/Gemfile +1 -3
  5. data/Gemfile.devtools +45 -33
  6. data/README.md +4 -21
  7. data/Rakefile +1 -4
  8. data/TODO +0 -2
  9. data/auom.gemspec +3 -3
  10. data/config/flay.yml +1 -1
  11. data/config/flog.yml +1 -1
  12. data/config/mutant.yml +2 -0
  13. data/config/roodi.yml +2 -2
  14. data/lib/auom.rb +29 -26
  15. data/lib/auom/algebra.rb +2 -8
  16. data/lib/auom/equalization.rb +0 -58
  17. data/lib/auom/inspection.rb +43 -6
  18. data/spec/shared/operation_behavior.rb +3 -1
  19. data/spec/spec_helper.rb +2 -12
  20. data/spec/unit/auom/algebra/add_spec.rb +3 -3
  21. data/spec/unit/auom/equalization/{equal_value_spec.rb → equality_operator_spec.rb} +0 -0
  22. data/spec/unit/auom/relational/{greater_than_or_equal_to_spec.rb → greater_than_or_equal_to_predicate_spec.rb} +0 -0
  23. data/spec/unit/auom/relational/{greater_than_spec.rb → greater_than_predicate_spec.rb} +0 -0
  24. data/spec/unit/auom/relational/{less_than_or_equal_to_spec.rb → less_than_or_equal_to_predicate_spec.rb} +0 -0
  25. data/spec/unit/auom/relational/{less_than_spec.rb → less_than_predicate_spec.rb} +0 -0
  26. data/spec/unit/auom/unit/class_methods/try_convert_spec.rb +6 -0
  27. data/spec/unit/auom/unit/{same_unit_spec.rb → same_unit_predicate_spec.rb} +0 -0
  28. data/spec/unit/auom/unit/{unitless_spec.rb → unitless_predicate_spec.rb} +2 -2
  29. metadata +69 -81
  30. data/config/heckle.yml +0 -14
  31. data/lib/auom/version.rb +0 -3
  32. data/spec/shared/command_method_behavior.rb +0 -7
  33. data/spec/shared/each_method_behaviour.rb +0 -15
  34. data/spec/shared/hash_method_behavior.rb +0 -17
  35. data/spec/shared/idempotent_method_behavior.rb +0 -7
  36. data/spec/shared/invertible_method_behaviour.rb +0 -9
  37. data/spec/spec.opts +0 -3
  38. data/spec/unit/auom/equalization/eql_spec.rb +0 -40
  39. data/spec/unit/auom/equalization/hash_spec.rb +0 -13
data/.gitignore CHANGED
@@ -1,3 +1,6 @@
1
1
  /Gemfile.lock
2
2
  /tmp
3
3
  /coverage
4
+ /.rbx
5
+ /.bundle
6
+ /vendor
@@ -1,11 +1,11 @@
1
1
  language: ruby
2
- script: 'bundle exec rake spec'
2
+ script: 'bundle exec rake ci'
3
3
  rvm:
4
4
  - 1.8.7
5
- - 1.9.2
6
5
  - 1.9.3
7
- # - jruby-18mode Disabled for core dump on travis http://travis-ci.org/#!/mbj/veritas-elasticsearch-adapter/jobs/1769741
8
- # - jruby-19mode Disabled for core dump on travis http://travis-ci.org/#!/mbj/veritas-elasticsearch-adapter/jobs/1768119
6
+ - 1.9.2
7
+ - jruby-18mode
8
+ - jruby-19mode
9
9
  - rbx-18mode
10
10
  - rbx-19mode
11
11
  notifications:
@@ -1,3 +1,11 @@
1
+ # v0.0.6 2013-01-03
2
+
3
+ * [change] Update dependencies
4
+
5
+ # v0.0.5 2012-12-10
6
+
7
+ * [feature] use devtools and test with mutant
8
+
1
9
  # v0.0.4 2012-11-20
2
10
 
3
11
  * [feature] Support for relational operatiors >, <, >= and <=
data/Gemfile CHANGED
@@ -4,7 +4,5 @@ source 'https://rubygems.org'
4
4
 
5
5
  gemspec
6
6
 
7
- group :development do
8
- gem 'devtools', :git => 'https://github.com/mbj/devtools'
9
- end
7
+ gem 'devtools', :git => 'https://github.com/datamapper/devtools'
10
8
  eval File.read('Gemfile.devtools')
@@ -1,52 +1,64 @@
1
- group :development do
2
- gem 'rake', '~> 0.9.2'
3
- gem 'rspec', '~> 1.3.2'
4
- gem 'yard', '~> 0.8.3'
5
- end
1
+ # encoding: utf-8
6
2
 
7
- group :guard do
8
- gem 'guard', '~> 1.1.1'
9
- gem 'guard-bundler', '~> 0.1.3'
10
- gem 'guard-rspec', '~> 0.7.3'
11
- gem 'rb-inotify', :git => 'https://github.com/mbj/rb-inotify'
3
+ group :development do
4
+ gem 'rake', '~> 10.0.3'
5
+ gem 'rspec', '~> 2.13.0'
6
+ gem 'yard', '~> 0.8.5'
12
7
  end
13
8
 
14
- group :benchmarks do
15
- gem 'rbench', '~> 0.2.3'
9
+ group :yard do
10
+ gem 'kramdown', '~> 0.14.2'
16
11
  end
17
12
 
18
- platform :jruby do
19
- group :jruby do
20
- gem 'jruby-openssl', '~> 0.7.4'
21
- end
13
+ group :guard do
14
+ gem 'guard', '~> 1.6.2'
15
+ gem 'guard-bundler', '~> 1.0.0'
16
+ gem 'guard-rspec', '~> 2.4.1'
17
+
18
+ # file system change event handling
19
+ gem 'rb-fchange', '~> 0.0.6', :require => false
20
+ gem 'rb-fsevent', '~> 0.9.3', :require => false
21
+ gem 'rb-inotify', '~> 0.9.0', :require => false
22
+
23
+ gem 'listen', '~> 0.7.3'
24
+
25
+ # notification handling
26
+ gem 'libnotify', '~> 0.8.0', :require => false
27
+ gem 'rb-notifu', '~> 0.0.4', :require => false
28
+ gem 'terminal-notifier-guard', '~> 1.5.3', :require => false
22
29
  end
23
30
 
24
31
  group :metrics do
25
- gem 'flay', '~> 1.4.2'
26
- gem 'flog', '~> 2.5.1'
27
- gem 'reek', '~> 1.2.8', :git => 'https://github.com/dkubb/reek.git'
28
- gem 'roodi', '~> 2.1.0'
29
- gem 'yardstick', '~> 0.7.0'
30
- gem 'simplecov'
32
+ gem 'flay', '~> 2.1.0'
33
+ gem 'flog', '~> 3.2.2'
34
+ gem 'reek', '~> 1.3.1'
35
+ gem 'metric_fu-roodi', '~> 2.2.1'
36
+ gem 'yardstick', '~> 0.9.4'
31
37
 
32
38
  platforms :ruby_18, :ruby_19 do
33
39
  # this indirectly depends on ffi which does not build on ruby-head
34
40
  gem 'yard-spellcheck', '~> 0.1.5'
35
41
  end
36
42
 
37
- platforms :mri_18 do
38
- gem 'arrayfields', '~> 4.7.4' # for metric_fu
39
- gem 'fattr', '~> 2.2.0' # for metric_fu
40
- gem 'heckle', '~> 1.4.3'
41
- gem 'json', '~> 1.7.3' # for metric_fu rake task
42
- gem 'map', '~> 6.0.1' # for metric_fu
43
- gem 'metric_fu', '~> 2.1.1'
44
- gem 'mspec', '~> 1.5.17'
45
- gem 'rcov', '~> 1.0.0'
46
- gem 'ruby2ruby', '= 1.2.2' # for heckle
43
+ platforms :mri_19, :rbx do
44
+ gem 'mutant', '~> 0.2.20'
45
+ end
46
+
47
+ platforms :mri_19 do
48
+ gem 'simplecov', '~> 0.7.1'
47
49
  end
48
50
 
49
51
  platforms :rbx do
50
- gem 'pelusa', '~> 0.2.1'
52
+ gem 'pelusa', '~> 0.2.2'
53
+ end
54
+ end
55
+
56
+ group :benchmarks do
57
+ gem 'rbench', '~> 0.2.3'
58
+ end
59
+
60
+ platform :jruby do
61
+ group :jruby do
62
+ gem 'jruby-openssl', '~> 0.8.2'
51
63
  end
52
64
  end
data/README.md CHANGED
@@ -3,7 +3,7 @@ AUOM Algebra (for) Units of Measuerment
3
3
 
4
4
  [![Build Status](https://secure.travis-ci.org/mbj/auom.png?branch=master)](http://travis-ci.org/mbj/auom)
5
5
  [![Dependency Status](https://gemnasium.com/mbj/auom.png)](https://gemnasium.com/mbj/auom)
6
- [![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/mbj/auom)
6
+ [![Code Climate](https://codeclimate.com/github/mbj/auom.png)](https://codeclimate.com/github/mbj/auom)
7
7
 
8
8
  This is another unit system for ruby.
9
9
  It was created since I was not confident about the existing once.
@@ -67,26 +67,9 @@ Contributing
67
67
  (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
68
68
  * Send me a pull request. Bonus points for topic branches.
69
69
 
70
- License
71
- -------
70
+ Copyright
71
+ ---------
72
72
 
73
73
  Copyright (c) 2012 Markus Schirp
74
74
 
75
- Permission is hereby granted, free of charge, to any person obtaining
76
- a copy of this software and associated documentation files (the
77
- "Software"), to deal in the Software without restriction, including
78
- without limitation the rights to use, copy, modify, merge, publish,
79
- distribute, sublicense, and/or sell copies of the Software, and to
80
- permit persons to whom the Software is furnished to do so, subject to
81
- the following conditions:
82
-
83
- The above copyright notice and this permission notice shall be
84
- included in all copies or substantial portions of the Software.
85
-
86
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
87
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
88
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
89
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
90
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
91
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
92
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
75
+ See LICENSE for details
data/Rakefile CHANGED
@@ -1,5 +1,2 @@
1
- # encoding: utf-8
2
-
3
1
  require 'devtools'
4
-
5
- Devtools.init
2
+ Devtools.init_rake_tasks
data/TODO CHANGED
@@ -1,3 +1 @@
1
- * Remove more custom typecasting logic? Can we coerce to SUnit::Unit?
2
- * Use code metrics
3
1
  * Make buildin units configurable
@@ -1,9 +1,8 @@
1
1
  # -*- encoding: utf-8 -*-
2
- require File.expand_path('../lib/auom/version', __FILE__)
3
2
 
4
3
  Gem::Specification.new do |s|
5
4
  s.name = 'auom'
6
- s.version = AUOM::VERSION.dup
5
+ s.version = '0.0.6'
7
6
 
8
7
  s.authors = ['Markus Schirp']
9
8
  s.email = 'mbj@seonic.net'
@@ -17,5 +16,6 @@ Gem::Specification.new do |s|
17
16
 
18
17
  s.rubygems_version = '1.8.10'
19
18
 
20
- s.add_runtime_dependency('backports', '~> 2.6.3')
19
+ s.add_dependency('backports', [ '~> 3.0', '>= 3.0.3' ])
20
+ s.add_dependency('equalizer', '~> 0.0.5')
21
21
  end
@@ -1,3 +1,3 @@
1
1
  ---
2
2
  threshold: 12
3
- total_score: 128.0
3
+ total_score: 99.0
@@ -1,2 +1,2 @@
1
1
  ---
2
- threshold: 24.6
2
+ threshold: 20.6
@@ -0,0 +1,2 @@
1
+ name: auom
2
+ namespace: AUOM
@@ -3,7 +3,7 @@ AbcMetricMethodCheck:
3
3
  score: 25.1
4
4
  AssignmentInConditionalCheck: { }
5
5
  CaseMissingElseCheck: { }
6
- ClassLineCountCheck: { line_count: 315 }
6
+ ClassLineCountCheck: { line_count: 317 }
7
7
  ClassNameCheck:
8
8
  pattern: !ruby/regexp /\A(?:[A-Z]+|[A-Z][a-z](?:[A-Z]?[a-z])+)\z/
9
9
  ClassVariableCheck: { }
@@ -14,7 +14,7 @@ ForLoopCheck: { }
14
14
  MethodLineCountCheck: { line_count: 14 }
15
15
  MethodNameCheck:
16
16
  pattern: !ruby/regexp /\A(?:[a-z\d](?:_?[a-z\d])+[?!=]?|\[\]=?|==|<=>|<<|[+*&|-])\z/
17
- ModuleLineCountCheck: { line_count: 318 }
17
+ ModuleLineCountCheck: { line_count: 320 }
18
18
  ModuleNameCheck:
19
19
  pattern: !ruby/regexp /\A(?:[A-Z]+|[A-Z][a-z](?:[A-Z]?[a-z])+)\z/
20
20
  ParameterNumberCheck: { parameter_count: 3 }
@@ -1,5 +1,6 @@
1
1
  require 'rational'
2
2
  require 'backports'
3
+ require 'equalizer'
3
4
 
4
5
  require 'auom/algebra'
5
6
  require 'auom/equalization'
@@ -10,6 +11,7 @@ require 'auom/relational'
10
11
  module AUOM
11
12
  # A scalar with units
12
13
  class Unit
14
+ include Equalizer.new(:scalar, :numerators, :denominators)
13
15
  include Algebra
14
16
  include Equalization
15
17
  include Inspection
@@ -199,30 +201,6 @@ module AUOM
199
201
  self
200
202
  end
201
203
 
202
- private
203
-
204
- # Initialize unit
205
- #
206
- # @param [Rational] scalar
207
- # @param [Enumerable] numerators
208
- # @param [Enumerable] denominators
209
- #
210
- # @api private
211
- #
212
- def initialize(scalar, numerators, denominators)
213
- @scalar = scalar
214
-
215
- [numerators, denominators].permutation do |left, right|
216
- left.delete_if { |item| right.delete_at(right.index(item) || right.length) }
217
- end
218
-
219
- @numerators = numerators.freeze
220
- @denominators = denominators.freeze
221
-
222
- @unit = [@numerators, @denominators].freeze
223
- @scalar.freeze
224
- end
225
-
226
204
  # Return converted operand or raise error
227
205
  #
228
206
  # @param [Object] operand
@@ -259,12 +237,37 @@ module AUOM
259
237
  when self
260
238
  operand
261
239
  when Fixnum, Rational
262
- self.new(operand)
240
+ new(operand)
263
241
  else
264
242
  nil
265
243
  end
266
244
  end
267
245
 
246
+
247
+ private
248
+
249
+ # Initialize unit
250
+ #
251
+ # @param [Rational] scalar
252
+ # @param [Enumerable] numerators
253
+ # @param [Enumerable] denominators
254
+ #
255
+ # @api private
256
+ #
257
+ def initialize(scalar, numerators, denominators)
258
+ @scalar = scalar
259
+
260
+ [numerators, denominators].permutation do |left, right|
261
+ left.delete_if { |item| right.delete_at(right.index(item) || right.length) }
262
+ end
263
+
264
+ @numerators = numerators.freeze
265
+ @denominators = denominators.freeze
266
+
267
+ @unit = [@numerators, @denominators].freeze
268
+ @scalar.freeze
269
+ end
270
+
268
271
  # Return rational converted from value
269
272
  #
270
273
  # @param [Object] value
@@ -281,7 +284,7 @@ module AUOM
281
284
  when Rational
282
285
  value
283
286
  when Fixnum
284
- Rational(value, 1)
287
+ Rational(value)
285
288
  else
286
289
  raise ArgumentError, "#{value.inspect} cannot be converted to rational"
287
290
  end
@@ -23,14 +23,8 @@ module AUOM
23
23
  def add(operand)
24
24
  klass = self.class
25
25
  operand = klass.convert(operand)
26
-
27
26
  assert_same_unit(operand)
28
-
29
- klass.new(
30
- operand.scalar + scalar,
31
- numerators.dup,
32
- denominators.dup
33
- )
27
+ klass.new(operand.scalar + scalar, numerators.dup, denominators.dup)
34
28
  end
35
29
 
36
30
  alias_method :+, :add
@@ -55,7 +49,7 @@ module AUOM
55
49
  # @api public
56
50
  #
57
51
  def substract(operand)
58
- self.add(self.class.convert(operand) * -1)
52
+ add(self.class.convert(operand) * -1)
59
53
  end
60
54
 
61
55
  alias_method :-, :substract
@@ -28,63 +28,5 @@ module AUOM
28
28
  def ==(other)
29
29
  eql?(self.class.try_convert(other))
30
30
  end
31
-
32
- # Check for equivalent value and not try to convert
33
- #
34
- # @param [Object] other
35
- #
36
- # @example
37
- #
38
- # u = Unit.new(1, :meter)
39
- # u == u # => true
40
- # u == 1 # => false
41
- # u == Unit.new(1, :meter) # => true
42
- #
43
- # u = Unit.new(1)
44
- # u == 1 # => false
45
- # u == Rational(1) # => false
46
- # u == 1.0 # => false
47
- #
48
- # @return [true]
49
- # return true if is other is a unit and scalar and unit is the same
50
- #
51
- # @return [false]
52
- # return false otherwise
53
- #
54
- # @api public
55
- #
56
- def eql?(other)
57
- (instance_of?(other.class) && cmp?(other))
58
- end
59
-
60
- # Return hash value
61
- #
62
- # @return [Fixnum]
63
- #
64
- # @example
65
- #
66
- # Unit.new(1, :meter).to_hash # => 012345678
67
- #
68
- # @api public
69
- #
70
- def hash
71
- scalar.hash ^ unit.hash
72
- end
73
-
74
- private
75
-
76
- # Compare with other unit instance
77
- #
78
- # @return [true]
79
- # returns true if unit and scalar is aequivalent
80
- #
81
- # @return [false]
82
- # return false otherwise
83
- #
84
- # @api private
85
- #
86
- def cmp?(other)
87
- scalar.eql?(other.scalar) && unit.eql?(other.unit)
88
- end
89
31
  end
90
32
  end
@@ -20,15 +20,33 @@ module AUOM
20
20
  # @api private
21
21
  #
22
22
  def pretty_scalar
23
- scalar = self.scalar
24
-
25
23
  unless fractions?
26
- scalar.to_i
24
+ integer_value
27
25
  else
28
- '~%0.4f' % scalar.to_f
26
+ '~%0.4f' % float_value
29
27
  end
30
28
  end
31
29
 
30
+ # Return float value
31
+ #
32
+ # @return [Float]
33
+ #
34
+ # @api private
35
+ #
36
+ def float_value
37
+ scalar.to_f
38
+ end
39
+
40
+ # Return integer value
41
+ #
42
+ # @return [Fixnum]
43
+ #
44
+ # @api private
45
+ #
46
+ def integer_value
47
+ scalar.to_i
48
+ end
49
+
32
50
  # Return prettyfied unit part
33
51
  #
34
52
  # @return [String]
@@ -62,8 +80,27 @@ module AUOM
62
80
  # @api private
63
81
  #
64
82
  def fractions?
65
- scalar = self.scalar
66
- !(scalar.numerator % scalar.denominator).zero?
83
+ !(scalar_numerator % scalar_denominator).zero?
84
+ end
85
+
86
+ # Return scalar numerator
87
+ #
88
+ # @return [Fixnum]
89
+ #
90
+ # @api private
91
+ #
92
+ def scalar_numerator
93
+ scalar.numerator
94
+ end
95
+
96
+ # Return scalar denominator
97
+ #
98
+ # @return [Fixnum]
99
+ #
100
+ # @api private
101
+ #
102
+ def scalar_denominator
103
+ scalar.denominator
67
104
  end
68
105
 
69
106
  # Return prettified units
@@ -4,7 +4,9 @@ shared_examples_for 'an operation' do
4
4
  end
5
5
 
6
6
  it 'is idempotent on equivalency' do
7
- should eql(instance_eval(&self.class.subject))
7
+ first = subject
8
+ __memoized.delete(:subject)
9
+ should eql(first)
8
10
  end
9
11
 
10
12
  its(:scalar) { should be_kind_of(::Rational) }
@@ -1,13 +1,3 @@
1
- begin
2
- require 'rspec' # try for RSpec 2
3
- rescue LoadError
4
- require 'spec' # try for RSpec 1
5
- RSpec = Spec::Runner
6
- end
7
-
8
- $LOAD_PATH << File.expand_path('../lib', __FILE__)
9
-
10
- Dir.glob('spec/examples/**/*.rb').each { |file| require File.expand_path(file) }
11
- Dir[File.expand_path('../{support,shared}/**/*.rb', __FILE__)].each { |f| require f }
12
-
13
1
  require 'auom'
2
+ require 'devtools'
3
+ Devtools.init_spec_helper
@@ -30,7 +30,7 @@ describe AUOM::Algebra,'#add' do
30
30
  end
31
31
 
32
32
  context 'when unit is unitful' do
33
- let(:arguments) { [1,:meter] }
33
+ let(:arguments) { [1,:meter, :euro] }
34
34
 
35
35
  context 'and operand is a Fixnum' do
36
36
  let(:operand) { 1 }
@@ -51,9 +51,9 @@ describe AUOM::Algebra,'#add' do
51
51
  end
52
52
 
53
53
  context 'and operand is a compatible unit' do
54
- let(:operand) { AUOM::Unit.new(1,:meter) }
54
+ let(:operand) { AUOM::Unit.new(1,:meter, :euro) }
55
55
 
56
- it { should eql(AUOM::Unit.new(2,:meter)) }
56
+ it { should eql(AUOM::Unit.new(2,:meter, :euro)) }
57
57
  end
58
58
  end
59
59
  end
@@ -5,6 +5,12 @@ describe AUOM,'.try_convert' do
5
5
 
6
6
  let(:object) { AUOM::Unit }
7
7
 
8
+ context 'with unit' do
9
+ let(:value) { AUOM::Unit.new(1) }
10
+
11
+ it { should be(value) }
12
+ end
13
+
8
14
  context 'with nil' do
9
15
  let(:value) { nil }
10
16
 
@@ -1,9 +1,9 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe AUOM::Unit,'#unitless?' do
3
+ describe AUOM::Unit, '#unitless?' do
4
4
  subject { object.unitless? }
5
5
 
6
- let(:object) { described_class.new(1,*unit) }
6
+ let(:object) { described_class.new(1, *unit) }
7
7
 
8
8
  context 'when unit is unitless' do
9
9
  let(:unit) { [] }
metadata CHANGED
@@ -1,48 +1,62 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: auom
3
- version: !ruby/object:Gem::Version
4
- hash: 23
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.6
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 0
9
- - 4
10
- version: 0.0.4
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Markus Schirp
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-11-20 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2013-03-03 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: backports
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '3.0'
22
+ - - ! '>='
23
+ - !ruby/object:Gem::Version
24
+ version: 3.0.3
25
+ type: :runtime
22
26
  prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
27
+ version_requirements: !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ~>
31
+ - !ruby/object:Gem::Version
32
+ version: '3.0'
33
+ - - ! '>='
34
+ - !ruby/object:Gem::Version
35
+ version: 3.0.3
36
+ - !ruby/object:Gem::Dependency
37
+ name: equalizer
38
+ requirement: !ruby/object:Gem::Requirement
24
39
  none: false
25
- requirements:
40
+ requirements:
26
41
  - - ~>
27
- - !ruby/object:Gem::Version
28
- hash: 17
29
- segments:
30
- - 2
31
- - 6
32
- - 3
33
- version: 2.6.3
42
+ - !ruby/object:Gem::Version
43
+ version: 0.0.5
34
44
  type: :runtime
35
- version_requirements: *id001
45
+ prerelease: false
46
+ version_requirements: !ruby/object:Gem::Requirement
47
+ none: false
48
+ requirements:
49
+ - - ~>
50
+ - !ruby/object:Gem::Version
51
+ version: 0.0.5
36
52
  description:
37
53
  email: mbj@seonic.net
38
54
  executables: []
39
-
40
55
  extensions: []
41
-
42
- extra_rdoc_files:
56
+ extra_rdoc_files:
43
57
  - TODO
44
58
  - LICENSE
45
- files:
59
+ files:
46
60
  - .gitignore
47
61
  - .rspec
48
62
  - .travis.yml
@@ -57,7 +71,7 @@ files:
57
71
  - auom.gemspec
58
72
  - config/flay.yml
59
73
  - config/flog.yml
60
- - config/heckle.yml
74
+ - config/mutant.yml
61
75
  - config/roodi.yml
62
76
  - config/site.reek
63
77
  - config/yardstick.yml
@@ -66,31 +80,22 @@ files:
66
80
  - lib/auom/equalization.rb
67
81
  - lib/auom/inspection.rb
68
82
  - lib/auom/relational.rb
69
- - lib/auom/version.rb
70
83
  - spec/rcov.opts
71
- - spec/shared/command_method_behavior.rb
72
- - spec/shared/each_method_behaviour.rb
73
- - spec/shared/hash_method_behavior.rb
74
- - spec/shared/idempotent_method_behavior.rb
75
84
  - spec/shared/incompatible_operation_behavior.rb
76
- - spec/shared/invertible_method_behaviour.rb
77
85
  - spec/shared/operation_behavior.rb
78
86
  - spec/shared/sunits_shared.rb
79
- - spec/spec.opts
80
87
  - spec/spec_helper.rb
81
88
  - spec/unit/auom/algebra/add_spec.rb
82
89
  - spec/unit/auom/algebra/divide_spec.rb
83
90
  - spec/unit/auom/algebra/multiply_spec.rb
84
91
  - spec/unit/auom/algebra/substract_spec.rb
85
- - spec/unit/auom/equalization/eql_spec.rb
86
- - spec/unit/auom/equalization/equal_value_spec.rb
87
- - spec/unit/auom/equalization/hash_spec.rb
92
+ - spec/unit/auom/equalization/equality_operator_spec.rb
88
93
  - spec/unit/auom/inspection/class_methods/prettify_unit_part_spec.rb
89
94
  - spec/unit/auom/inspection/inspect_spec.rb
90
- - spec/unit/auom/relational/greater_than_or_equal_to_spec.rb
91
- - spec/unit/auom/relational/greater_than_spec.rb
92
- - spec/unit/auom/relational/less_than_or_equal_to_spec.rb
93
- - spec/unit/auom/relational/less_than_spec.rb
95
+ - spec/unit/auom/relational/greater_than_or_equal_to_predicate_spec.rb
96
+ - spec/unit/auom/relational/greater_than_predicate_spec.rb
97
+ - spec/unit/auom/relational/less_than_or_equal_to_predicate_spec.rb
98
+ - spec/unit/auom/relational/less_than_predicate_spec.rb
94
99
  - spec/unit/auom/unit/assert_same_unit_spec.rb
95
100
  - spec/unit/auom/unit/class_methods/convert_spec.rb
96
101
  - spec/unit/auom/unit/class_methods/lookup_spec.rb
@@ -99,68 +104,51 @@ files:
99
104
  - spec/unit/auom/unit/class_methods/units_spec.rb
100
105
  - spec/unit/auom/unit/denominators_spec.rb
101
106
  - spec/unit/auom/unit/numerators_spec.rb
102
- - spec/unit/auom/unit/same_unit_spec.rb
107
+ - spec/unit/auom/unit/same_unit_predicate_spec.rb
103
108
  - spec/unit/auom/unit/scalar_spec.rb
104
109
  - spec/unit/auom/unit/unit_spec.rb
105
- - spec/unit/auom/unit/unitless_spec.rb
110
+ - spec/unit/auom/unit/unitless_predicate_spec.rb
106
111
  homepage: http://github.com/mbj/auom
107
112
  licenses: []
108
-
109
113
  post_install_message:
110
114
  rdoc_options: []
111
-
112
- require_paths:
115
+ require_paths:
113
116
  - lib
114
- required_ruby_version: !ruby/object:Gem::Requirement
117
+ required_ruby_version: !ruby/object:Gem::Requirement
115
118
  none: false
116
- requirements:
117
- - - ">="
118
- - !ruby/object:Gem::Version
119
- hash: 3
120
- segments:
121
- - 0
122
- version: "0"
123
- required_rubygems_version: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - ! '>='
121
+ - !ruby/object:Gem::Version
122
+ version: '0'
123
+ required_rubygems_version: !ruby/object:Gem::Requirement
124
124
  none: false
125
- requirements:
126
- - - ">="
127
- - !ruby/object:Gem::Version
128
- hash: 3
129
- segments:
130
- - 0
131
- version: "0"
125
+ requirements:
126
+ - - ! '>='
127
+ - !ruby/object:Gem::Version
128
+ version: '0'
132
129
  requirements: []
133
-
134
130
  rubyforge_project:
135
- rubygems_version: 1.8.24
131
+ rubygems_version: 1.8.23
136
132
  signing_key:
137
133
  specification_version: 3
138
134
  summary: Algebra (with) Units Of Measurement
139
- test_files:
135
+ test_files:
140
136
  - spec/rcov.opts
141
- - spec/shared/command_method_behavior.rb
142
- - spec/shared/each_method_behaviour.rb
143
- - spec/shared/hash_method_behavior.rb
144
- - spec/shared/idempotent_method_behavior.rb
145
137
  - spec/shared/incompatible_operation_behavior.rb
146
- - spec/shared/invertible_method_behaviour.rb
147
138
  - spec/shared/operation_behavior.rb
148
139
  - spec/shared/sunits_shared.rb
149
- - spec/spec.opts
150
140
  - spec/spec_helper.rb
151
141
  - spec/unit/auom/algebra/add_spec.rb
152
142
  - spec/unit/auom/algebra/divide_spec.rb
153
143
  - spec/unit/auom/algebra/multiply_spec.rb
154
144
  - spec/unit/auom/algebra/substract_spec.rb
155
- - spec/unit/auom/equalization/eql_spec.rb
156
- - spec/unit/auom/equalization/equal_value_spec.rb
157
- - spec/unit/auom/equalization/hash_spec.rb
145
+ - spec/unit/auom/equalization/equality_operator_spec.rb
158
146
  - spec/unit/auom/inspection/class_methods/prettify_unit_part_spec.rb
159
147
  - spec/unit/auom/inspection/inspect_spec.rb
160
- - spec/unit/auom/relational/greater_than_or_equal_to_spec.rb
161
- - spec/unit/auom/relational/greater_than_spec.rb
162
- - spec/unit/auom/relational/less_than_or_equal_to_spec.rb
163
- - spec/unit/auom/relational/less_than_spec.rb
148
+ - spec/unit/auom/relational/greater_than_or_equal_to_predicate_spec.rb
149
+ - spec/unit/auom/relational/greater_than_predicate_spec.rb
150
+ - spec/unit/auom/relational/less_than_or_equal_to_predicate_spec.rb
151
+ - spec/unit/auom/relational/less_than_predicate_spec.rb
164
152
  - spec/unit/auom/unit/assert_same_unit_spec.rb
165
153
  - spec/unit/auom/unit/class_methods/convert_spec.rb
166
154
  - spec/unit/auom/unit/class_methods/lookup_spec.rb
@@ -169,8 +157,8 @@ test_files:
169
157
  - spec/unit/auom/unit/class_methods/units_spec.rb
170
158
  - spec/unit/auom/unit/denominators_spec.rb
171
159
  - spec/unit/auom/unit/numerators_spec.rb
172
- - spec/unit/auom/unit/same_unit_spec.rb
160
+ - spec/unit/auom/unit/same_unit_predicate_spec.rb
173
161
  - spec/unit/auom/unit/scalar_spec.rb
174
162
  - spec/unit/auom/unit/unit_spec.rb
175
- - spec/unit/auom/unit/unitless_spec.rb
163
+ - spec/unit/auom/unit/unitless_predicate_spec.rb
176
164
  has_rdoc:
@@ -1,14 +0,0 @@
1
- ---
2
- library: auom
3
- namespace: AUOM
4
- aliases:
5
- AUOM::Relational:
6
- '>=': greater_than_or_equal_to?
7
- '<=': less_than_or_equal_to?
8
- '<': less_than?
9
- '>': greater_than?
10
- AUOM::Algebra:
11
- '-': substract
12
- '+': add
13
- '*': multiply
14
- '/': divide
@@ -1,3 +0,0 @@
1
- module AUOM
2
- VERSION = '0.0.4'.freeze
3
- end
@@ -1,7 +0,0 @@
1
- # encoding: utf-8
2
-
3
- shared_examples_for 'a command method' do
4
- it 'returns self' do
5
- should equal(object)
6
- end
7
- end
@@ -1,15 +0,0 @@
1
- # encoding: utf-8
2
-
3
- shared_examples_for 'an #each method' do
4
- it_should_behave_like 'a command method'
5
-
6
- context 'with no block' do
7
- subject { object.each }
8
-
9
- it { should be_instance_of(to_enum.class) }
10
-
11
- it 'yields the expected values' do
12
- subject.to_a.should eql(object.to_a)
13
- end
14
- end
15
- end
@@ -1,17 +0,0 @@
1
- # encoding: utf-8
2
-
3
- shared_examples_for 'a hash method' do
4
- it_should_behave_like 'an idempotent method'
5
-
6
- specification = proc do
7
- should be_instance_of(Fixnum)
8
- end
9
-
10
- it 'is a fixnum' do
11
- instance_eval(&specification)
12
- end
13
-
14
- it 'memoizes the hash code' do
15
- subject.should eql(object.memoized(:hash))
16
- end
17
- end
@@ -1,7 +0,0 @@
1
- # encoding: utf-8
2
-
3
- shared_examples_for 'an idempotent method' do
4
- it 'is idempotent' do
5
- should equal(instance_eval(&self.class.subject))
6
- end
7
- end
@@ -1,9 +0,0 @@
1
- # encoding: utf-8
2
-
3
- shared_examples_for 'an invertible method' do
4
- it_should_behave_like 'an idempotent method'
5
-
6
- it 'is invertible' do
7
- subject.inverse.should equal(object)
8
- end
9
- end
@@ -1,3 +0,0 @@
1
- --color
2
- --loadby random
3
- --format profile
@@ -1,40 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe AUOM::Equalization,'#eql?' do
4
- subject { object.eql?(other) }
5
-
6
- let(:object) { AUOM::Unit.new(1,:meter) }
7
-
8
- context 'when is other kind of object' do
9
- let(:other) { Object.new }
10
-
11
- it { should be(false) }
12
- end
13
-
14
- context 'when is same kind of object' do
15
- let(:other) { AUOM::Unit.new(scalar,*unit) }
16
-
17
- let(:scalar) { 1 }
18
- let(:unit) { [:meter] }
19
-
20
- context 'and scalar and unit are the same' do
21
- it { should be(true) }
22
- end
23
-
24
- context 'and scalar is differend' do
25
- let(:scalar) { 2 }
26
- it { should be(false) }
27
- end
28
-
29
- context 'and unit is differend' do
30
- let(:unit) { [:euro] }
31
- it { should be(false) }
32
- end
33
-
34
- context 'and scalar and unit is differend' do
35
- let(:scalar) { 2 }
36
- let(:unit) { [:euro] }
37
- it { should be(false) }
38
- end
39
- end
40
- end
@@ -1,13 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe AUOM::Equalization, '#hash' do
4
- subject { object.hash }
5
-
6
- let(:object) { AUOM::Unit.new(1) }
7
-
8
- it { should be_a(Fixnum) }
9
-
10
- it_should_behave_like 'an idempotent method'
11
-
12
- it { should be(Rational(1).hash ^ [[],[]].hash) }
13
- end