setfu 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/setfu/version.rb +1 -1
- data/lib/setfu.rb +20 -6
- data/setfu.gemspec +3 -3
- metadata +20 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 72565070f36393bad5dc9eb8cbeba0dd49804c9a
|
4
|
+
data.tar.gz: c1efb9f7cff8811a55282d31f6cbe0eda66a1bff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1256c103b03a79bfc631377c9eea812cbea1743fb7526a7c1fbd1edc366f04edc6fe6777a1ba320bb14d8290924bf701af2f7720327dfcabb7a9255d63488842
|
7
|
+
data.tar.gz: 729b9b90ff87bda5ccd4b70f9241daed3a613ac16d9b74933903c79fe5bf0d5ba732aaf4cc659ad156d473c94b356caef1f4bec6d9a383111a73aa4ea91783ee
|
data/lib/setfu/version.rb
CHANGED
data/lib/setfu.rb
CHANGED
@@ -325,8 +325,11 @@ class Set
|
|
325
325
|
end
|
326
326
|
|
327
327
|
def include?(items)
|
328
|
+
return false if @bits == 0 # empty sets include nothing including other empty sets
|
328
329
|
if(items.class==Set)
|
329
|
-
|
330
|
+
tmp = @bits & items.to_i
|
331
|
+
return false if tmp==0
|
332
|
+
return (tmp) == items.to_i
|
330
333
|
elsif(items.class==Range)
|
331
334
|
f=items.first.ord
|
332
335
|
l=items.last.ord
|
@@ -336,11 +339,13 @@ class Set
|
|
336
339
|
t = t << f
|
337
340
|
return (@bits & t) == t
|
338
341
|
elsif(items.respond_to? :each_char)
|
342
|
+
return false if items.empty?
|
339
343
|
items.each_char do |item|
|
340
344
|
t = 1 << item.ord
|
341
345
|
return false if 0 == (t & @bits)
|
342
346
|
end
|
343
347
|
elsif(items.respond_to? :each)
|
348
|
+
return false if items.empty?
|
344
349
|
items.each do |item|
|
345
350
|
return false if false==include?(item)
|
346
351
|
end
|
@@ -377,7 +382,7 @@ class Set
|
|
377
382
|
def to_s
|
378
383
|
rtn = ""
|
379
384
|
each_member do |ch|
|
380
|
-
rtn += ch.chr
|
385
|
+
rtn += ch.chr(Encoding::UTF_8)
|
381
386
|
end
|
382
387
|
rtn
|
383
388
|
end
|
@@ -385,7 +390,7 @@ class Set
|
|
385
390
|
def to_a(int = true)
|
386
391
|
rtn = []
|
387
392
|
each_member do |num|
|
388
|
-
rtn.push int ? num : num.chr
|
393
|
+
rtn.push int ? num : num.chr(Encoding::UTF_8)
|
389
394
|
end
|
390
395
|
rtn
|
391
396
|
end
|
@@ -399,7 +404,7 @@ class Set
|
|
399
404
|
th -= 1
|
400
405
|
each_member do |num|
|
401
406
|
# byebug unless int
|
402
|
-
rtn.push int ? num : num.chr
|
407
|
+
rtn.push int ? num : num.chr(Encoding::UTF_8)
|
403
408
|
if ((last+1)==num)
|
404
409
|
# byebug if cnt.nil?
|
405
410
|
cnt += 1
|
@@ -514,13 +519,13 @@ class Set
|
|
514
519
|
when :array_chars
|
515
520
|
rtn = []
|
516
521
|
ary.each do |elm|
|
517
|
-
rtn.push elm.chr
|
522
|
+
rtn.push elm.chr(Encoding::UTF_8)
|
518
523
|
end
|
519
524
|
return rtn
|
520
525
|
when :string
|
521
526
|
rtn = []
|
522
527
|
ary.each do |elm|
|
523
|
-
rtn.push elm.chr
|
528
|
+
rtn.push elm.chr(Encoding::UTF_8)
|
524
529
|
end
|
525
530
|
return rtn.join ""
|
526
531
|
else # :set
|
@@ -671,3 +676,12 @@ class Range
|
|
671
676
|
include SetFuMixinBinarySubsetOperator
|
672
677
|
include SetFuMixinBinaryProperOperator
|
673
678
|
end
|
679
|
+
|
680
|
+
=begin
|
681
|
+
# BAD IDEA ... nil is usually an error
|
682
|
+
class NilClass # treat nil as empty set
|
683
|
+
def to_set
|
684
|
+
return Set.new
|
685
|
+
end
|
686
|
+
end
|
687
|
+
=end
|
data/setfu.gemspec
CHANGED
@@ -26,7 +26,7 @@ When characters are used, the ordinate value sets the element bit of the interna
|
|
26
26
|
spec.required_ruby_version = '>= 1.9.1'
|
27
27
|
|
28
28
|
spec.add_development_dependency "bundler", "~> 1.3"
|
29
|
-
spec.add_development_dependency
|
30
|
-
spec.add_development_dependency 'rspec',
|
31
|
-
spec.add_development_dependency 'byebug',
|
29
|
+
spec.add_development_dependency 'rake', '~> 10.1', '>= 10.1.0'
|
30
|
+
spec.add_development_dependency 'rspec', '~> 3.3', '>= 3.3.0'
|
31
|
+
spec.add_development_dependency 'byebug', '~> 5.0', '>= 5.0.0'
|
32
32
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: setfu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bryan Colvin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -28,6 +28,9 @@ dependencies:
|
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.1'
|
31
34
|
- - ">="
|
32
35
|
- !ruby/object:Gem::Version
|
33
36
|
version: 10.1.0
|
@@ -35,6 +38,9 @@ dependencies:
|
|
35
38
|
prerelease: false
|
36
39
|
version_requirements: !ruby/object:Gem::Requirement
|
37
40
|
requirements:
|
41
|
+
- - "~>"
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '10.1'
|
38
44
|
- - ">="
|
39
45
|
- !ruby/object:Gem::Version
|
40
46
|
version: 10.1.0
|
@@ -42,6 +48,9 @@ dependencies:
|
|
42
48
|
name: rspec
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
44
50
|
requirements:
|
51
|
+
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '3.3'
|
45
54
|
- - ">="
|
46
55
|
- !ruby/object:Gem::Version
|
47
56
|
version: 3.3.0
|
@@ -49,6 +58,9 @@ dependencies:
|
|
49
58
|
prerelease: false
|
50
59
|
version_requirements: !ruby/object:Gem::Requirement
|
51
60
|
requirements:
|
61
|
+
- - "~>"
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '3.3'
|
52
64
|
- - ">="
|
53
65
|
- !ruby/object:Gem::Version
|
54
66
|
version: 3.3.0
|
@@ -56,6 +68,9 @@ dependencies:
|
|
56
68
|
name: byebug
|
57
69
|
requirement: !ruby/object:Gem::Requirement
|
58
70
|
requirements:
|
71
|
+
- - "~>"
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '5.0'
|
59
74
|
- - ">="
|
60
75
|
- !ruby/object:Gem::Version
|
61
76
|
version: 5.0.0
|
@@ -63,6 +78,9 @@ dependencies:
|
|
63
78
|
prerelease: false
|
64
79
|
version_requirements: !ruby/object:Gem::Requirement
|
65
80
|
requirements:
|
81
|
+
- - "~>"
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '5.0'
|
66
84
|
- - ">="
|
67
85
|
- !ruby/object:Gem::Version
|
68
86
|
version: 5.0.0
|