degu 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 02a36ad5dbf090d463a5bcb6663647276524efbb
4
- data.tar.gz: a708d7d3b15edb9fb5d91b7efebf17598467ad1e
3
+ metadata.gz: 4e1b02137af8847c510794f926d80ffbfc5b84d2
4
+ data.tar.gz: 5d8192a1b19a420d21239c802ee500569a9c4936
5
5
  SHA512:
6
- metadata.gz: 3ab2d609d9206f6b59125c371b21121edaa394f39abc20356bb8b762e55c214c0453b4a82170e90ba080b4b870f04eb43162a4a29037239d3ddd72d3fae306fa
7
- data.tar.gz: 6490e1a508f3b904cc429f37e268a3658f5021aa80b61678530f4eb4f7ceb2e4255726dfeec9f692bfb3c7e07b720f4df0111212154681f6d8d59c4d419aa7a9
6
+ metadata.gz: b06177da0477233c6c725a652ecdec069181f6b0e163274592e67d09abfd60b267d6329b9f3ce035255f2d0ded93dfc24843b454b38089c5ff20b1ffe7bea61c
7
+ data.tar.gz: 5582e0df367d999df9a282948e848e660f3e50108b316f559d4b6add179f269a9d2771e2d2a8c9a964c1bbc1927cd0f94633839e8636ccb0053542a176078645
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.0
1
+ 0.7.0
data/degu.gemspec CHANGED
@@ -1,14 +1,14 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: degu 0.6.0 ruby lib
2
+ # stub: degu 0.7.0 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "degu"
6
- s.version = "0.6.0"
6
+ s.version = "0.7.0"
7
7
 
8
8
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
9
9
  s.require_paths = ["lib"]
10
10
  s.authors = ["Florian Frank"]
11
- s.date = "2015-04-24"
11
+ s.date = "2015-05-05"
12
12
  s.description = "Library that includes enums, and rails support for enums and bitfield sets."
13
13
  s.email = "dev@pkw.de"
14
14
  s.extra_rdoc_files = ["README.md", "lib/degu.rb", "lib/degu/has_enum.rb", "lib/degu/has_set.rb", "lib/degu/polite.rb", "lib/degu/renum.rb", "lib/degu/renum/enumerated_value.rb", "lib/degu/renum/enumerated_value_type_factory.rb", "lib/degu/rude.rb", "lib/degu/version.rb"]
@@ -211,7 +211,7 @@ module Degu
211
211
  end
212
212
 
213
213
  # Sorts enumerated values into the order in which they're declared.
214
- def <=> other
214
+ def <=>(other)
215
215
  if self.class === other
216
216
  index <=> other.index
217
217
  elsif other_value = self.class[other]
@@ -219,6 +219,17 @@ module Degu
219
219
  end
220
220
  end
221
221
 
222
+ def ==(other)
223
+ case self <=> other
224
+ when nil
225
+ nil
226
+ when 0
227
+ true
228
+ else
229
+ false
230
+ end
231
+ end
232
+
222
233
  # Returns a marshalled string for this enum instance.
223
234
  def _dump(limit = -1)
224
235
  Marshal.dump(name, limit)
data/lib/degu/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Degu
2
2
  # Degu version
3
- VERSION = '0.6.0'
3
+ VERSION = '0.7.0'
4
4
  VERSION_ARRAY = VERSION.split('.').map(&:to_i) # :nodoc:
5
5
  VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
6
6
  VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
data/spec/renum_spec.rb CHANGED
@@ -334,6 +334,7 @@ describe 'comparing renums' do
334
334
 
335
335
  it 'can compare to indexes' do
336
336
  expect(LogLevel::WARN).to be < 3
337
+ expect(LogLevel::WARN < 2).to eq false
337
338
  end
338
339
 
339
340
  it 'cannot compare to unknown indexes' do
@@ -349,3 +350,32 @@ describe 'comparing renums' do
349
350
  expect(LogLevel::DEBUG <=> :foo).to be_nil
350
351
  end
351
352
  end
353
+
354
+ describe 'renums being equal to things' do
355
+ it 'can be to other enums of the same type' do
356
+ expect(LogLevel::WARN).to eq LogLevel::WARN
357
+ expect(LogLevel::WARN == LogLevel::ERROR).to eq false
358
+ end
359
+
360
+ it 'cannot be equal to enums of other types' do
361
+ expect(LogLevel::DEBUG == Nix::BAR).to be_nil
362
+ end
363
+
364
+ it 'can be equal to indexes' do
365
+ expect(LogLevel::WARN).to eq 2
366
+ expect(LogLevel::WARN == 3).to eq false
367
+ end
368
+
369
+ it 'cannot be equal to unknown indexes' do
370
+ expect(LogLevel::DEBUG == 666).to be_nil
371
+ end
372
+
373
+ it 'can be equal to names' do
374
+ expect(LogLevel::WARN).to eq :WARN
375
+ expect(LogLevel::WARN == :ERROR).to eq false
376
+ end
377
+
378
+ it 'cannot be equal to unknown names' do
379
+ expect(LogLevel::DEBUG == :foo).to be_nil
380
+ end
381
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: degu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Frank
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-24 00:00:00.000000000 Z
11
+ date: 2015-05-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gem_hadar