positionrange 0.6.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.txt +5 -0
- data/README.txt +27 -11
- data/Rakefile +1 -8
- data/lib/position_range/version.rb +1 -1
- data/lib/position_range.rb +1 -1
- metadata +4 -4
data/CHANGELOG.txt
CHANGED
data/README.txt
CHANGED
@@ -14,32 +14,44 @@ http://www.logilogi.org (http://foundation.logilogi.org).
|
|
14
14
|
|
15
15
|
== Usage
|
16
16
|
|
17
|
-
|
17
|
+
First require it.
|
18
|
+
|
19
|
+
$ irb
|
18
20
|
|
19
|
-
|
21
|
+
> require 'rubygems'
|
22
|
+
> require 'positionrange'
|
23
|
+
|
24
|
+
You can assign random attributes to PositionRanges.
|
20
25
|
|
21
|
-
r.cow => 'moo'
|
26
|
+
> r = PositionRange.new(1,10, :cow => 'moo')
|
27
|
+
=> 1...10
|
28
|
+
> r.cow
|
29
|
+
=> "moo"
|
22
30
|
|
23
31
|
You can also create a PositionRange::List directly from a string.
|
24
32
|
|
25
|
-
l = PositionRange::List.from_s('0,10:5,15')
|
33
|
+
> l = PositionRange::List.from_s('0,10:5,15')
|
34
|
+
=> [0...10, 5...15]
|
26
35
|
|
27
36
|
Then you can get the combined size.
|
28
37
|
|
29
|
-
l.range_size
|
38
|
+
> l.range_size
|
39
|
+
=> 20
|
30
40
|
|
31
41
|
Or line up overlaps.
|
32
42
|
|
33
|
-
l.line_up_overlaps!.to_s
|
43
|
+
> l.line_up_overlaps!.to_s
|
44
|
+
=> "0,5:5,10:5,10:10,15"
|
34
45
|
|
35
46
|
Clustering overlaps maintains attributes.
|
36
47
|
|
37
|
-
l = PositionRange::List.new([
|
38
|
-
|
39
|
-
|
40
|
-
|
48
|
+
> l = PositionRange::List.new([
|
49
|
+
PositionRange.new(0,10, :cow => 'moo'),
|
50
|
+
PositionRange.new(5,15, :goat => 7)
|
51
|
+
])
|
52
|
+
=> [0...10, 5...15]
|
41
53
|
|
42
|
-
|
54
|
+
> output = [
|
43
55
|
PositionRange::List.new([
|
44
56
|
PositionRange.new(0,5, :cow => 'moo')]),
|
45
57
|
PositionRange::List.new([
|
@@ -48,6 +60,10 @@ Clustering overlaps maintains attributes.
|
|
48
60
|
PositionRange::List.new([
|
49
61
|
PositionRange.new(10,15, :goat => 7)])
|
50
62
|
]
|
63
|
+
=> [[0...5], [5...10, 5...10], [10...15]]
|
64
|
+
|
65
|
+
> l.cluster_overlaps == output
|
66
|
+
=> true
|
51
67
|
|
52
68
|
== Download
|
53
69
|
|
data/Rakefile
CHANGED
@@ -68,17 +68,10 @@ Rake::GemPackageTask.new(spec) do |p|
|
|
68
68
|
end
|
69
69
|
|
70
70
|
desc "Publish the docs, gem, and release files"
|
71
|
-
task :
|
71
|
+
task :deploy => [:release, :pdoc] do
|
72
72
|
puts 'Published gem'
|
73
73
|
end
|
74
74
|
|
75
|
-
desc "Publish the gem"
|
76
|
-
task :pgem => [:package] do
|
77
|
-
Rake::SshFilePublisher.new("gems.rubyonrails.org",
|
78
|
-
"/u/sites/gems/gems", "pkg", "#{PKG_FILE_NAME}.gem").upload
|
79
|
-
`ssh gems.rubyonrails.org '/u/sites/gems/gemupdate.sh'`
|
80
|
-
end
|
81
|
-
|
82
75
|
desc "Publish the API documentation"
|
83
76
|
task :pdoc => [:rdoc] do
|
84
77
|
sh "rsync -azv --no-perms --no-times doc/*" +
|
data/lib/position_range.rb
CHANGED
@@ -28,7 +28,7 @@
|
|
28
28
|
# first...last, not first..last
|
29
29
|
|
30
30
|
$:.unshift(File.dirname(__FILE__)) unless
|
31
|
-
|
31
|
+
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
|
32
32
|
|
33
33
|
class PositionRange < Range
|
34
34
|
include Comparable
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: positionrange
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wybo Wiersma
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-12-
|
12
|
+
date: 2008-12-31 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -28,11 +28,11 @@ files:
|
|
28
28
|
- CHANGELOG.txt
|
29
29
|
- LICENSE.txt
|
30
30
|
- lib/position_range.rb
|
31
|
-
- lib/positionrange.rb
|
32
31
|
- lib/position_range
|
32
|
+
- lib/position_range/version.rb
|
33
33
|
- lib/position_range/error.rb
|
34
34
|
- lib/position_range/list.rb
|
35
|
-
- lib/
|
35
|
+
- lib/positionrange.rb
|
36
36
|
- test/position_range_list_test.rb
|
37
37
|
- test/position_range_test.rb
|
38
38
|
- test/test_helper.rb
|