Sha256: fe57deee6ee07beaf77de6b3fd1bf771936c10193b993cb71d149be297426338

Contents?: true

Size: 1.71 KB

Versions: 12

Compression:

Stored size: 1.71 KB

Contents

o:$YARD::CodeObjects::MethodObject:
@name:offset:@docstringIC:YARD::Docstring"ÆReturns a two-element array containing the beginning and ending offsets of
the <em>n</em>th match.

   m = /(.)(.)(\d+)(\d)/.match("THX1138.")
   m.offset(0)   #=> [1, 7]
   m.offset(4)   #=> [6, 7]
:@objectu:YARD::StubProxyMatchData#offset:
@summary0:	@all"îReturns a two-element array containing the beginning and ending offsets of
the <em>n</em>th match.

   m = /(.)(.)(\d+)(\d)/.match("THX1138.")
   m.offset(0)   #=> [1, 7]
   m.offset(4)   #=> [6, 7]


@overload offset(n)
  @return [Array]:@ref_tags[:
@tags[o:YARD::Tags::OverloadTag
;
u;MatchData#offset;;;IC;	"
;
u;MatchData#offset;0;
"@return [Array];[;[o:YARD::Tags::Tag
;
0;0:@types["
Array:
@text":@tag_name"return;0:@parameters[[:n0;0:@signature"offset(n);"
overload:@current_file_has_commentsF:@scope:
instance;[:@docstring_extra0:@files[["	re.c0:@namespaceu;MatchData:
@path"MatchData#offset;[:@visibility:public:@source"¼/*
 *  call-seq:
 *     mtch.offset(n)   => array
 *  
 *  Returns a two-element array containing the beginning and ending offsets of
 *  the <em>n</em>th match.
 *     
 *     m = /(.)(.)(\d+)(\d)/.match("THX1138.")
 *     m.offset(0)   #=> [1, 7]
 *     m.offset(4)   #=> [6, 7]
 */

static VALUE
match_offset(match, n)
    VALUE match, n;
{
    int i = NUM2INT(n);

    match_check(match);
    if (i < 0 || RMATCH(match)->regs->num_regs <= i)
    rb_raise(rb_eIndexError, "index %d out of matches", i);

    if (RMATCH(match)->regs->beg[i] < 0)
    return rb_assoc_new(Qnil, Qnil);

    return rb_assoc_new(INT2FIX(RMATCH(match)->regs->beg[i]),
            INT2FIX(RMATCH(match)->regs->end[i]));
}:@source_type:c

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
pry-doc-0.4.4 lib/pry-doc/core_docs_18/objects/MatchData/offset_i.dat
pry-doc-0.4.3 lib/pry-doc/core_docs_18/objects/MatchData/offset_i.dat
pry-doc-0.4.2 lib/pry-doc/core_docs_18/objects/MatchData/offset_i.dat
pry-doc-0.4.1 lib/pry-doc/core_docs_18/objects/MatchData/offset_i.dat
pry-doc-0.4.0 lib/pry-doc/core_docs_18/objects/MatchData/offset_i.dat
pry-doc-0.3.0 lib/pry-doc/core_docs_18/objects/MatchData/offset_i.dat
pry-doc-0.2.4pre1 lib/pry-doc/core_docs_18/objects/MatchData/offset_i.dat
pry-doc-0.2.3pre1 lib/pry-doc/core_docs_18/objects/MatchData/offset_i.dat
pry-doc-0.2.1 lib/pry-doc/core_docs_18/objects/MatchData/offset_i.dat
pry-doc-0.2.0 lib/pry-doc/core_docs_18/objects/MatchData/offset_i.dat
pry-doc-0.1.5pre1 lib/pry-doc/core_docs_18/objects/MatchData/offset_i.dat
pry-0.6.9pre1-i386-mingw32 lib/pry/core_docs_18/objects/MatchData/offset_i.dat