Permalink
Browse files

Removed class MultiMatchData

  • Loading branch information...
1 parent e081eff commit 43f4e9a0044bf0e2421e23ec11f9ca5d5d8b6dd9 @dichodaemon dichodaemon committed Mar 26, 2007
Showing with 4 additions and 54 deletions.
  1. +1 −3 ext/oregexp.c
  2. +0 −48 lib/oniguruma.rb
  3. +3 −3 test/test_oniguruma.rb
View
@@ -627,9 +627,7 @@ oregexp_scan(VALUE self, VALUE str, OnigRegion * region)
region, ONIG_OPTION_NONE);
} while ( beg >= 0);
- VALUE rb_cMultiMatchData = rb_const_get(mOniguruma, rb_intern("MultiMatchData")) ;
-
- return rb_funcall(rb_cMultiMatchData, rb_intern("new"), 2, string_str, matches) ;
+ return matches;
}
struct scan_packet {
View
@@ -319,54 +319,6 @@ def source
end
- class MultiMatchData
- def initialize( string, matches )
- @matches = matches
- @string = string
- end
-
- def position index
- @matches[index].begin(0)
- end
-
- def [] ( value1, value2 = nil )
- unless value2
- @matches[value1]
- else
- @matches[value1, value2]
- end
- end
-
- def begin index
- @matches[index].begin(0)
- end
-
- def end index
- @matches[index].end(0)
- end
-
- def length
- @matches.size
- end
- alias size length
-
- def offset index
- [self.begin(index), self.end(index) ]
- end
-
- def string
- @string.freeze
- end
-
- def to_a
- @matches
- end
-
- def each &block
- @matches.each &block
- end
- end
-
end
class ::MatchData
alias old_aref :[]
View
@@ -202,15 +202,15 @@ def test_match_all
matches.each { |m| a << m.offset(0) }
assert_equal( [ [1,3], [5,7], [10,12] ], a)
assert_equal( 3, matches.size )
- assert_equal( 10, matches.position(2) )
- assert_equal( "ca", matches.string[matches.begin(1)...matches.end(1)])
+ assert_equal( 10, matches[2].begin( 0 ) )
+ assert_equal( "ca", matches[1].string[matches[1].begin( 0 )...matches[1].end( 0 )])
end
def test_scan
reg = Oniguruma::ORegexp.new( 'ca' )
a = []
matches = reg.match_all( 'ocatacachaca' ) { |m| a << m.offset(0) }
- assert_kind_of(Oniguruma::MultiMatchData, matches)
+ #assert_kind_of(Oniguruma::MultiMatchData, matches)
assert_equal( [ [1,3], [5,7], [10,12] ], a)
end

0 comments on commit 43f4e9a

Please sign in to comment.