Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion doc/language/character_selectors.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ contained in the selector itself:
'abracadabra'.delete('abc') # => "rdr"
'0123456789'.delete('258') # => "0134679"
'!@#$%&*()_+'.delete('+&#') # => "!@$%*()_"
'тест'.delete('т') # => "ес"
'こんにちは'.delete('に') # => "こんちは"

Note that order and repetitions do not matter:
Expand Down
12 changes: 6 additions & 6 deletions doc/matchdata/begin.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ returns the offset of the beginning of the <tt>n</tt>th match:
m[3] # => "113"
m.begin(3) # => 3

m = /(т)(е)(с)/.match('тест')
# => #<MatchData "тес" 1:"т" 2:"е" 3:"с">
m[0] # => "тес"
m.begin(0) # => 0
m[3] # => "с"
m.begin(3) # => 2
m = /(ん)(に)(ち)/.match('こんにちは')
# => #<MatchData "んにち" 1:"" 2:"" 3:"">
m[0] # => "んにち"
m.begin(0) # => 1
m[3] # => ""
m.begin(3) # => 3

When string or symbol argument +name+ is given,
returns the offset of the beginning for the named match:
Expand Down
12 changes: 6 additions & 6 deletions doc/matchdata/bytebegin.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ returns the offset of the beginning of the <tt>n</tt>th match:
m[3] # => "113"
m.bytebegin(3) # => 3

m = /(т)(е)(с)/.match('тест')
# => #<MatchData "тес" 1:"т" 2:"е" 3:"с">
m[0] # => "тес"
m.bytebegin(0) # => 0
m[3] # => "с"
m.bytebegin(3) # => 4
m = /(ん)(に)(ち)/.match('こんにちは')
# => #<MatchData "んにち" 1:"" 2:"" 3:"">
m[0] # => "んにち"
m.bytebegin(0) # => 3
m[3] # => ""
m.bytebegin(3) # => 9

When string or symbol argument +name+ is given,
returns the offset of the beginning for the named match:
Expand Down
12 changes: 6 additions & 6 deletions doc/matchdata/byteend.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ returns the offset of the end of the <tt>n</tt>th match:
m[3] # => "113"
m.byteend(3) # => 6

m = /(т)(е)(с)/.match('тест')
# => #<MatchData "тес" 1:"т" 2:"е" 3:"с">
m[0] # => "тес"
m.byteend(0) # => 6
m[3] # => "с"
m.byteend(3) # => 6
m = /(ん)(に)(ち)/.match('こんにちは')
# => #<MatchData "んにち" 1:"" 2:"" 3:"">
m[0] # => "んにち"
m.byteend(0) # => 12
m[3] # => ""
m.byteend(3) # => 12

When string or symbol argument +name+ is given,
returns the offset of the end for the named match:
Expand Down
12 changes: 6 additions & 6 deletions doc/matchdata/end.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ returns the offset of the end of the <tt>n</tt>th match:
m[3] # => "113"
m.end(3) # => 6

m = /(т)(е)(с)/.match('тест')
# => #<MatchData "тес" 1:"т" 2:"е" 3:"с">
m[0] # => "тес"
m.end(0) # => 3
m[3] # => "с"
m.end(3) # => 3
m = /(ん)(に)(ち)/.match('こんにちは')
# => #<MatchData "んにち" 1:"" 2:"" 3:"">
m[0] # => "んにち"
m.end(0) # => 4
m[3] # => ""
m.end(3) # => 4

When string or symbol argument +name+ is given,
returns the offset of the end for the named match:
Expand Down
12 changes: 6 additions & 6 deletions doc/matchdata/offset.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ returns the starting and ending offsets of the <tt>n</tt>th match:
m[3] # => "113"
m.offset(3) # => [3, 6]

m = /(т)(е)(с)/.match('тест')
# => #<MatchData "тес" 1:"т" 2:"е" 3:"с">
m[0] # => "тес"
m.offset(0) # => [0, 3]
m[3] # => "с"
m.offset(3) # => [2, 3]
m = /(ん)(に)(ち)/.match('こんにちは')
# => #<MatchData "んにち" 1:"" 2:"" 3:"">
m[0] # => "んにち"
m.offset(0) # => [1, 4]
m[3] # => ""
m.offset(3) # => [3, 4]

When string or symbol argument +name+ is given,
returns the starting and ending offsets for the named match:
Expand Down
8 changes: 4 additions & 4 deletions random.c
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ rand_init(const rb_random_interface_t *rng, rb_random_t *rnd, VALUE seed)
static VALUE
random_init(int argc, VALUE *argv, VALUE obj)
{
const rb_random_interface_t *rng;
const rb_random_interface_t *rng = NULL;
rb_random_t *rnd = try_get_rnd(obj, &rng);

if (!rng) {
Expand Down Expand Up @@ -1296,7 +1296,7 @@ rand_bytes(const rb_random_interface_t *rng, rb_random_t *rnd, long n)
static VALUE
random_bytes(VALUE obj, VALUE len)
{
const rb_random_interface_t *rng;
const rb_random_interface_t *rng = NULL;
rb_random_t *rnd = try_get_rnd(obj, &rng);
return rand_bytes(rng, rnd, NUM2LONG(rb_to_int(len)));
}
Expand Down Expand Up @@ -1570,7 +1570,7 @@ static VALUE rand_random(int argc, VALUE *argv, VALUE obj, const rb_random_inter
static VALUE
random_rand(int argc, VALUE *argv, VALUE obj)
{
const rb_random_interface_t *rng;
const rb_random_interface_t *rng = NULL;
rb_random_t *rnd = try_get_rnd(obj, &rng);
VALUE v = rand_random(argc, argv, obj, rng, rnd);
check_random_number(v, argv);
Expand Down Expand Up @@ -1621,7 +1621,7 @@ rand_random(int argc, VALUE *argv, VALUE obj, const rb_random_interface_t *rng,
static VALUE
rand_random_number(int argc, VALUE *argv, VALUE obj)
{
const rb_random_interface_t *rng;
const rb_random_interface_t *rng = NULL;
rb_random_t *rnd = try_get_rnd(obj, &rng);
VALUE v = rand_random(argc, argv, obj, rng, rnd);
if (NIL_P(v)) v = rand_random(0, 0, obj, rng, rnd);
Expand Down