るりまサーチ

最速Rubyリファレンスマニュアル検索!
24717件ヒット [201-300件を表示] (0.253秒)

別のキーワード

  1. rbconfig ruby
  2. fiddle ruby_free
  3. fiddle build_ruby_platform
  4. rake ruby
  5. rubygems/defaults ruby_engine

クラス

キーワード

検索結果

<< < 1 2 3 4 5 ... > >>

RubyVM::AbstractSyntaxTree::Node#first_lineno -> Integer (21213.0)

ソースコード中で、self を表すテキストが最初に現れる行番号を返します。

...ソースコード中で、self を表すテキストが最初に現れる行番号を返します。

行番号は1-originです。

//emlist[][ruby]{
node = RubyVM::AbstractSyntaxTree.parse('1 + 2')
p node.first_lineno # => 1
//}...

RubyVM::InstructionSequence#first_lineno -> Integer (21201.0)

self が表す命令シーケンスの 1 行目の行番号を返します。

...の 1 行目の行番号を返します。

例1:irb で実行した場合

Ruby
VM::InstructionSequence.compile('num = 1 + 2').first_lineno
# => 1

例2:

# /tmp/method.rb
r
equire "foo-library"
def foo
p :foo
end

Ruby
VM::InstructionSequence.of(method(:foo)).first_lineno
# => 2...

Module#ruby2_keywords(method_name, ...) -> nil (18463.0)

For the given method names, marks the method as passing keywords through a normal argument splat. This should only be called on methods that accept an argument splat (`*args`) but not explicit keywords or a keyword splat. It marks the method such that if the method is called with keyword arguments, the final hash argument is marked with a special flag such that if it is the final element of a normal argument splat to another method call, and that method call does not include explicit keywords or a keyword splat, the final element is interpreted as keywords. In other words, keywords will be passed through the method to other methods.

...For the given method names, marks the method as passing keywords through
a normal argument splat. This should only be called on methods that
accept an argument splat (`*args`) but not explicit keywords or a
keyword splat. It marks the method such that if the method is called
with keyword arguments...
...argument is marked with a special
flag such that if it is the final element of a normal argument splat to
another method call, and that method call does not include explicit
keywords or a keyword splat, the final element is interpreted as
keywords. In other words, keywords will be passed through th...
...ethod to
other methods.

T
his should only be used for methods that delegate keywords to another
method, and only for backwards compatibility with Ruby versions before
2.7.

T
his method will probably be removed at some point, as it exists only
for backwards compatibility. As it does not exist in Ruby...

String#lstrip -> String (18451.0)

文字列の先頭にある空白文字を全て取り除いた新しい文字列を返します。 空白文字の定義は " \t\r\n\f\v\0" です。

...にある空白文字を全て取り除いた新しい文字列を返します。
空白文字の定義は " \t\r\n\f\v\0" です。

//emlist[例][ruby]{
p " abc\n".lstrip #=> "abc\n"
p "\t abc\n".lstrip #=> "abc\n"
p "abc\n".lstrip #=> "abc\n"
//}

@see String#strip, String#rstrip...

String#strip -> String (18451.0)

文字列先頭と末尾の空白文字を全て取り除いた文字列を生成して返します。 空白文字の定義は " \t\r\n\f\v\0" です。

...義は " \t\r\n\f\v\0" です。

//emlist[例][ruby]{
p " abc \r\n".strip #=> "abc"
p "abc\n".strip #=> "abc"
p " abc".strip #=> "abc"
p "abc".strip #=> "abc"
p " \0 abc \0".strip #=> "abc"

str = "\tabc\n"
p str.strip #=> "abc"
p str...
...#=> "\tabc\n" (元の文字列は変化しない)
//}

@see String#lstrip, String#rstrip...

絞り込み条件を変える

StringScanner#string -> String (18449.0)

スキャン対象にしている文字列を返します。

...mlist[例][ruby]{
r
equire 'strscan'

s = StringScanner.new('test string')
s.string # => "test string"
//}

返り値は freeze されていません。

//emlist[例][ruby]{
r
equire 'strscan'

s = StringScanner.new('test string')
s.string.frozen? # => false
//}

なお、このメソッドは String...
...ner.new に渡した
文字列をそのまま返しますが、この仕様が将来に渡って保証されるわけではありません。
この仕様に依存したコードを書かないようにしましょう。

//emlist[例][ruby]{
r
equire 'strscan'

str = 'test string'
s = StringScanner....
...new(str)
s.string == str # => true
s.string.eql?(str) # => true (将来は false になる可能性がある)
//}

また、返り値の文字列に対して破壊的な変更もできますが、
この操作がスキャン対象の文字列を変更することも保証されません。
この...

Rational#rationalize(eps = 0) -> Rational (18437.0)

自身から eps で指定した許容誤差の範囲に収まるような Rational を返 します。

...うな Rational を返
します。

eps を省略した場合は self を返します。

@param eps 許容する誤差

//emlist[例][ruby]{
r
= Rational(5033165, 16777216)
r
.rationalize # => (5033165/16777216)
r
.rationalize(Rational(0.01)) # => (3/10)
r
.rationalize(Rational(0....

StringIO#string -> String (18413.0)

自身が表す文字列を返します。

...たバッファとして使われている文字列です。
文字列は複製されないことに注意して下さい。

//emlist[例][ruby]{
r
equire "stringio"
sio = StringIO.new
sio << "abc"
s = sio.string
p s #=> "abc"
sio << "xyz"
p s #=> "abcxyz"
//}...

String#rstrip -> String (18357.0)

文字列の末尾にある空白文字を全て取り除いた新しい文字列を返します。 空白文字の定義は " \t\r\n\f\v\0" です。

...白文字の定義は " \t\r\n\f\v\0" です。

//emlist[例][ruby]{
p " abc\n".rstrip #=> " abc"
p " abc \t\r\n\0".rstrip #=> " abc"
p " abc".rstrip #=> " abc"
p " abc\0 ".rstrip #=> " abc"

str = "abc\n"
p str.rstrip #=> "abc"
p str #=> "abc\n"...
...(元の文字列は変化しない)
//}

@see String#lstrip,String#strip...
<< < 1 2 3 4 5 ... > >>