swissparser 0.11.0 → 0.11.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.
@@ -1,3 +1,8 @@
1
+ == 0.11.1 / 2009-11-17
2
+
3
+ * 1 bug fix:
4
+ - Corrected skip_entry! issue.
5
+
1
6
  == 0.11.0 / 2009-11-16
2
7
 
3
8
  * 1 new feature:
@@ -0,0 +1,7 @@
1
+ $ time ruby tutorial_1.rb uniprot_sprot.dat
2
+ Parsed: 512205
3
+ real 3313.672 user 3239.700 sys 66.360 pcpu 99.77
4
+
5
+ $ time ruby bioruby.rb uniprot_sprot.dat
6
+ 512205
7
+ real 1054.322 user 998.170 sys 55.580 pcpu 99.94
@@ -8,7 +8,7 @@ Feature: Sharing context
8
8
  YY b1
9
9
  c1
10
10
  //
11
- XX a1
11
+ XX a2
12
12
  YY b2
13
13
  c2
14
14
  //
@@ -40,9 +40,9 @@ Feature: Sharing context
40
40
  Scenario: Skipping entries
41
41
  Given a simple parser
42
42
  When I extend it
43
- And set with("XX") to skip the entry
43
+ And I set it to skip entries with("XX") containing "a1"
44
44
  And I run the extended parser on data
45
- Then the result should contain '0' entries
45
+ Then the result should contain '1' entries
46
46
 
47
47
 
48
48
 
@@ -37,11 +37,20 @@ When /^the after action returns @foo$/ do
37
37
  end
38
38
 
39
39
  When /^set with\("([^\"]*)"\) to skip the entry$/ do |key|
40
- @ext_parser = @ext_parser.extend do
41
- rules do
42
- with(key) { skip_entry! }
43
- end
44
- end
40
+
45
41
  end
46
42
 
47
43
 
44
+
45
+
46
+ When /^I set it to skip entries with\("([^\"]*)"\) containing "([^\"]*)"$/ do |key, val|
47
+ @ext_parser = @ext_parser.extend do
48
+ rules do
49
+ with(key) do |c,e|
50
+ if c.include?(val)
51
+ skip_entry!
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
@@ -23,7 +23,7 @@ require 'swissparser/parsing_rules'
23
23
 
24
24
  module Swiss
25
25
 
26
- VERSION = "0.11.0"
26
+ VERSION = "0.11.1"
27
27
 
28
28
 
29
29
  # Parser for a typical bioinformatic flat file.
@@ -164,7 +164,7 @@ module Swiss
164
164
  entry = @ctx.instance_exec( &@begin )
165
165
  data.each_line do |line|
166
166
  if @ctx.should_skip?
167
- if line == @separator
167
+ if line.include? @separator
168
168
  state = :end
169
169
  entry = init_entry
170
170
  end
@@ -211,7 +211,7 @@ module Swiss
211
211
 
212
212
  def parse_line( line, holder )
213
213
  line.chomp!
214
- if line == @separator
214
+ if line.include? @separator
215
215
  :end
216
216
  elsif line =~ /^(\S+)\s+(.*)$/
217
217
  key,value = $1,$2
@@ -5,26 +5,26 @@ module Swiss
5
5
  class ParsingContext
6
6
 
7
7
  def initialize(parameters)
8
- @params = parameters
9
- @skip = false
8
+ @params__ = parameters
9
+ @skip__ = false
10
10
  end
11
11
 
12
12
  # Retrieves a parsing parameter by key. Returns nil if
13
13
  # there is no parameter with the provided key.
14
14
  def param( key )
15
- @params[key]
15
+ @params__[key]
16
16
  end
17
17
 
18
18
  def skip_entry!()
19
- @skip = true
19
+ @skip__ = true
20
20
  end
21
21
 
22
22
  def should_skip?()
23
- @skip
23
+ @skip__
24
24
  end
25
25
 
26
26
  def reset_skip()
27
- @skip = false
27
+ @skip__ = false
28
28
  end
29
29
 
30
30
 
@@ -35,7 +35,7 @@ module Swiss
35
35
 
36
36
  #Method instance_exec exists since version 1.9
37
37
  if RUBY_VERSION < "1.9"
38
- #Used to execute rules and action using the ParsingContext as context
38
+ #Used to execuxte rules and action using the ParsingContext as context
39
39
  #Stolen from http://eigenclass.org/hiki/bounded+space+instance_exec
40
40
  def instance_exec(*args, &block)
41
41
  begin
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: swissparser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.11.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - paradigmatic
@@ -41,12 +41,13 @@ extensions: []
41
41
  extra_rdoc_files:
42
42
  - CHANGELOG.rdoc
43
43
  - README.rdoc
44
+ - benchmarks/whole_uniprot.txt
44
45
  files:
45
- - .gitignore
46
46
  - CHANGELOG.rdoc
47
47
  - LICENSE
48
48
  - README.rdoc
49
49
  - Rakefile
50
+ - benchmarks/whole_uniprot.txt
50
51
  - examples/data/EColPositives_noTAT.bas
51
52
  - examples/data/kegg_enzyme_short.txt
52
53
  - examples/data/uniprot.txt
data/.gitignore DELETED
@@ -1,9 +0,0 @@
1
- *~
2
- *#
3
-
4
- *.gemspec
5
- announcement.txt
6
-
7
- coverage/
8
- doc/
9
- pkg/