pms 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  == VERSION
4
4
 
5
- This documentation refers to pms version 0.0.1
5
+ This documentation refers to pms version 0.0.2
6
6
 
7
7
 
8
8
  == DESCRIPTION
@@ -44,9 +44,10 @@ You can find more examples in the <tt>spec/</tt> directory.
44
44
 
45
45
  == LINKS
46
46
 
47
- * <http://pms.rubyforge.org/>
48
- * <http://rubyforge.org/projects/pms>
49
- * <http://github.com/blackwinter/pms>
47
+ <b></b>
48
+ Documentation:: <http://pms.rubyforge.org/>
49
+ Source code:: <http://github.com/blackwinter/pms>
50
+ Rubyforge project:: <http://rubyforge.org/projects/pms>
50
51
 
51
52
 
52
53
  == AUTHORS
data/lib/pms/proxy.rb CHANGED
@@ -71,18 +71,26 @@ class PMS
71
71
  end
72
72
 
73
73
  def apply_operator(op, doc_nums)
74
+ results = self.results
75
+
74
76
  case op = op.to_s.downcase
75
77
  when 'and'
76
- @results &= doc_nums
78
+ results &= doc_nums
77
79
  when 'or'
78
- @results |= doc_nums
80
+ results |= doc_nums
79
81
  when 'not'
80
- @results -= doc_nums
82
+ results -= doc_nums
81
83
  else
82
84
  raise ArgumentError, "invalid operator '#{op}'"
83
85
  end
84
86
 
85
- self # allow chaining!
87
+ clone_with_results(results) # allow chaining!
88
+ end
89
+
90
+ def clone_with_results(results)
91
+ clone = self.clone
92
+ clone.instance_variable_set(:@results, results)
93
+ clone
86
94
  end
87
95
 
88
96
  end
data/lib/pms/version.rb CHANGED
@@ -4,7 +4,7 @@ class PMS
4
4
 
5
5
  MAJOR = 0
6
6
  MINOR = 0
7
- TINY = 1
7
+ TINY = 2
8
8
 
9
9
  class << self
10
10
 
data/spec/pms_spec.rb CHANGED
@@ -62,4 +62,24 @@ describe PMS do
62
62
  @pms.search('fox').adjacent('goose', 10).results.sort.should == [6]
63
63
  end
64
64
 
65
+ it 'should search case-insensitively' do
66
+ @pms.search('said').results.sort.should == [1, 4]
67
+ @pms.search('Said').results.sort.should == [1, 4]
68
+ end
69
+
70
+ it 'should not modify intermediate results' do
71
+ search1 = @pms.search('fox')
72
+ results1 = search1.results.sort
73
+ results1.should == [0, 3, 4, 6]
74
+
75
+ search2 = search1.or('goose')
76
+ results2 = search2.results.sort
77
+ results2.should == [0, 2, 3, 4, 6]
78
+
79
+ search2.and('GOAWAYFLAG').results.sort.should == []
80
+
81
+ search2.results.sort.should == results2
82
+ search1.results.sort.should == results1
83
+ end
84
+
65
85
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jens Wille
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-12-08 00:00:00 +01:00
12
+ date: 2008-12-09 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies: []
15
15