sequence 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
- # Copyright (C) 2006,2008 Caleb Clausen
1
+ # Copyright (C) 2006,2008, 2011 Caleb Clausen
2
2
  # Distributed under the terms of Ruby's license.
3
3
  class Sequence
4
- VERSION='0.2.3'
4
+ VERSION='0.2.4'
5
5
  end
@@ -1,5 +1,5 @@
1
1
  # $Id$
2
- # Copyright (C) 2006,2008 Caleb Clausen
2
+ # Copyright (C) 2006,2008, 2011 Caleb Clausen
3
3
  # Distributed under the terms of Ruby's license.
4
4
 
5
5
  #require 'yaml'
@@ -65,7 +65,7 @@ end
65
65
 
66
66
  # add a weak reference to the set
67
67
  def add(obj)
68
- return self if include? obj
68
+ # return self if include? obj
69
69
  # Symbol===obj || Fixnum===obj || nil==obj || true==obj || false==obj and
70
70
  # raise ArgumentError, "no immediates in weakrefset"
71
71
  id=ref obj
@@ -1,8 +1,8 @@
1
1
  # -*- encoding: utf-8 -*-
2
-
3
- require "#{File.dirname(__FILE__)}/lib/sequence/version"
4
- Sequence::Description=open("README.txt"){|f| f.read[/^==+ ?description[^\n]*?\n *\n?(.*?\n *\n.*?)\n *\n/im,1] }
5
- Sequence::Latest_changes="###"+open("History.txt"){|f| f.read[/\A===(.*?)(?====)/m,1] }
2
+ dir=File.dirname(__FILE__)
3
+ require "#{dir}/lib/sequence/version"
4
+ Sequence::Description=open("#{dir}/README.txt"){|f| f.read[/^==+ ?description[^\n]*?\n *\n?(.*?\n *\n.*?)\n *\n/im,1] }
5
+ Sequence::Latest_changes="###"+open("#{dir}/History.txt"){|f| f.read[/\A===(.*?)(?====)/m,1] }
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "sequence"
@@ -23,6 +23,7 @@ Gem::Specification.new do |s|
23
23
  s.test_files = %w[test/test_all.rb]
24
24
  s.summary = "A single api for reading and writing sequential data types."
25
25
  s.description = Sequence::Description
26
+ s.license="GPL-2.0"
26
27
 
27
28
  =begin
28
29
  if s.respond_to? :specification_version then
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2006 Caleb Clausen
1
+ # Copyright (C) 2006, 2011 Caleb Clausen
2
2
  # Distributed under the terms of Ruby's license.
3
3
  require './test/test_rexscan.rb'
4
4
  require './test/test_seqrex.rb'
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2006 Caleb Clausen
1
+ # Copyright (C) 2006, 2011 Caleb Clausen
2
2
  # Distributed under the terms of Ruby's license.
3
3
  $VERBOSE=1
4
4
  require 'test/unit'
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2006,2008 Caleb Clausen
1
+ # Copyright (C) 2006,2008, 2011 Caleb Clausen
2
2
  # Distributed under the terms of Ruby's license.
3
3
  $VERBOSE=1
4
4
  require 'test/unit'
@@ -158,34 +158,31 @@ $Debug=true
158
158
  end
159
159
 
160
160
  class List < Indexed
161
- def a_seq
162
-
163
- seq = Sequence::List.new(DATA.scan(/.{1,8}/m).map{|str| str.to_sequence})
161
+ def a_seq
162
+ seq = Sequence::List.new(DATA.scan(chunk_regex).map{|str| str.to_sequence})
164
163
  seq.pos=OFFSET
165
164
  seq
166
165
  end
167
166
 
167
+ def idx2chunknum(i,seq)
168
+ i/8
169
+ end
170
+ def chunk_regex; /.{1,8}/m end
171
+
168
172
  def test__lookup_idx
169
173
  seq=a_seq
170
174
  (0..DATA.size).map{|i|
171
- assert_equal i/8, seq._lookup_idx(i)
175
+ assert_equal idx2chunknum(i,seq), seq._lookup_idx(i)
172
176
  }
173
177
  end
174
178
 
175
179
  end
176
180
 
177
- class ListMaxxed < Indexed
178
- def a_seq
179
-
180
- seq = Sequence::List.new(DATA.scan(/./m).map{|str| str.to_sequence})
181
- seq.pos=OFFSET
182
- seq
183
- end
184
- def test__lookup_idx
185
- seq=a_seq
186
- (0...DATA.size).map{|i|
187
- assert_equal i, seq._lookup_idx(i)
188
- }
181
+ class ListMaxxed < List
182
+ def chunk_regex; /./m end
183
+ def idx2chunknum(i,seq)
184
+ return seq.size-1 if i>=seq.size
185
+ i
189
186
  end
190
187
  end
191
188
 
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2006 Caleb Clausen
1
+ # Copyright (C) 2006, 2011 Caleb Clausen
2
2
  # Distributed under the terms of Ruby's license.
3
3
  $VERBOSE=1
4
4
 
@@ -82,29 +82,36 @@ end
82
82
  assert_equal "[/([\\A]|^asdf(df)s)/, []]", _.inspect
83
83
 
84
84
 
85
- oldVERBOSE=$VERBOSE
86
- $VERBOSE=nil
87
- eval <<'END'
88
- _=@cu.group_anchors(/([\A[~]|^asdf(df)s)/,true)
89
- assert_equal "[/(?-mix:([\\A[~]|(^)asdf(df)s))/, [2]]", _.inspect
85
+ #yuck! supporting old ruby versions (<2.0) in this block.
86
+ #maybe just delete this?
87
+ begin
88
+ eval %{ /[[]/ }
89
+ rescue SyntaxError
90
+ open_bracket_in_char_class_needs_bs=true
91
+ end
92
+ oldVERBOSE=$VERBOSE
93
+ $VERBOSE=nil
94
+ eval <<-'END' unless open_bracket_in_char_class_needs_bs
95
+ _=@cu.group_anchors(/([\A[~]|^asdf(df)s)/,true)
96
+ assert_equal "[/(?-mix:([\\A[~]|(^)asdf(df)s))/, [2]]", _.inspect
90
97
 
91
- _=@cu.group_anchors(/(\A|[z^[~]asdf(df)s)/,nil)
92
- assert_equal "[/(\\A|[z^[~]asdf(df)s)/, []]", _.inspect
98
+ _=@cu.group_anchors(/(\A|[z^[~]asdf(df)s)/,nil)
99
+ assert_equal "[/(\\A|[z^[~]asdf(df)s)/, []]", _.inspect
93
100
 
94
- _=@cu.group_anchors(/(\A|[z^[~]asdf(df)s)/,true)
95
- assert_equal "[/(?-mix:((?!)|[z^[~]asdf(df)s))/, []]", _.inspect
101
+ _=@cu.group_anchors(/(\A|[z^[~]asdf(df)s)/,true)
102
+ assert_equal "[/(?-mix:((?!)|[z^[~]asdf(df)s))/, []]", _.inspect
96
103
 
97
- _=@cu.group_anchors(/([\A[~]|^asdf(df)s)/,nil)
98
- assert_equal "[/([\\A[~]|^asdf(df)s)/, []]", _.inspect
99
- END
100
- $VERBOSE=oldVERBOSE
104
+ _=@cu.group_anchors(/([\A[~]|^asdf(df)s)/,nil)
105
+ assert_equal "[/([\\A[~]|^asdf(df)s)/, []]", _.inspect
106
+ END
107
+ $VERBOSE=oldVERBOSE
101
108
 
102
109
  _=@cu.group_anchors(/([\A\[~]|^asdf(df)s)/,true)
103
110
  assert_equal "[/(?-mix:([\\A\\[~]|(^)asdf(df)s))/, [2]]", _.inspect
104
-
111
+
105
112
  _=@cu.group_anchors(/(\A|[z^\[~]asdf(df)s)/,nil)
106
113
  assert_equal "[/(\\A|[z^\\[~]asdf(df)s)/, []]", _.inspect
107
-
114
+
108
115
  _=@cu.group_anchors(/(\A|[z^\[~]asdf(df)s)/,true)
109
116
  assert_equal "[/(?-mix:((?!)|[z^\\[~]asdf(df)s))/, []]", _.inspect
110
117
 
metadata CHANGED
@@ -1,29 +1,32 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: sequence
3
- version: !ruby/object:Gem::Version
4
- version: 0.2.3
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.4
5
5
  platform: ruby
6
- authors:
6
+ authors:
7
7
  - Caleb Clausen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
-
12
- date: 2010-01-03 00:00:00 -08:00
13
- default_executable:
11
+ date: 2016-05-19 00:00:00.000000000 Z
14
12
  dependencies: []
15
-
16
- description: Sequence provides a unified api for access to sequential data types, like Strings, Arrays, Files, IOs, and Enumerations. Each sequence encapsulates some data and a current position within it. Some operations apply to data at (or relative to) the position, others are independant of position. The api contains operations for moving the position, reading and writing data (with or without moving the position) forward or backward from the current position or anywhere, scanning for patterns (like StringScanner, but it works in Files too, among others), and saving a position that will remain valid even after data is deleted or inserted elsewhere within the sequence. There are also some utility classes for making sequences reversed or circular, turning one-way sequences into two-way, buffering, and making sequences that are subsets or aggregations of existing sequences.
13
+ description: "Sequence provides a unified api for access to sequential data types,
14
+ like\nStrings, Arrays, Files, IOs, and Enumerations. This is the external \niterator
15
+ pattern (ruby's usual iterators are internal). Each sequence \nencapsulates some
16
+ data and a current position within it. Some operations \napply to data at (or relative
17
+ to) the position, others are independant \nof position. The api contains operations
18
+ for moving the position, and \nreading and writing data (with or without moving
19
+ the position) forward \nor backward from the current position or anywhere.\n\nIts
20
+ perhaps most unusual feature is the ability to scan for Regexps in\nnot just Strings,
21
+ but Files and any other type of sequence. "
17
22
  email: caleb (at) inforadical (dot) net
18
23
  executables: []
19
-
20
24
  extensions: []
21
-
22
- extra_rdoc_files:
25
+ extra_rdoc_files:
23
26
  - README.txt
24
27
  - COPYING
25
28
  - GPL
26
- files:
29
+ files:
27
30
  - COPYING
28
31
  - GPL
29
32
  - History.txt
@@ -49,6 +52,7 @@ files:
49
52
  - lib/sequence/reversed.rb
50
53
  - lib/sequence/shifting.rb
51
54
  - lib/sequence/singleitem.rb
55
+ - lib/sequence/stringio.rb
52
56
  - lib/sequence/stringlike.rb
53
57
  - lib/sequence/subseq.rb
54
58
  - lib/sequence/usedata.rb
@@ -62,32 +66,31 @@ files:
62
66
  - test/test_rexscan.rb
63
67
  - test/test_seqrex.rb
64
68
  - test/test_sequences.rb
65
- has_rdoc: true
66
69
  homepage: http://github.com/coatl/sequence
70
+ licenses:
71
+ - GPL-2.0
72
+ metadata: {}
67
73
  post_install_message:
68
- rdoc_options:
69
- - --main
74
+ rdoc_options:
75
+ - "--main"
70
76
  - README.txt
71
- require_paths:
77
+ require_paths:
72
78
  - lib
73
- required_ruby_version: !ruby/object:Gem::Requirement
74
- requirements:
79
+ required_ruby_version: !ruby/object:Gem::Requirement
80
+ requirements:
75
81
  - - ">="
76
- - !ruby/object:Gem::Version
77
- version: "0"
78
- version:
79
- required_rubygems_version: !ruby/object:Gem::Requirement
80
- requirements:
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ required_rubygems_version: !ruby/object:Gem::Requirement
85
+ requirements:
81
86
  - - ">="
82
- - !ruby/object:Gem::Version
83
- version: "0"
84
- version:
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
85
89
  requirements: []
86
-
87
90
  rubyforge_project: sequence
88
- rubygems_version: 1.3.1
91
+ rubygems_version: 2.5.1
89
92
  signing_key:
90
- specification_version: 2
93
+ specification_version: 4
91
94
  summary: A single api for reading and writing sequential data types.
92
- test_files:
95
+ test_files:
93
96
  - test/test_all.rb