るりまサーチ

最速Rubyリファレンスマニュアル検索!
228件ヒット [1-100件を表示] (0.049秒)

別のキーワード

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

ライブラリ

キーワード

検索結果

<< 1 2 3 > >>

RubyVM::InstructionSequence#to_a -> Array (26055.0)

self の情報を 14 要素の配列にして返します。

...。常に 1。

: misc

以下の要素から構成される Hash オブジェクト。

:arg_size: メソッド、ブロックが取る引数の総数(1 つもない場合は 0)。

:local_size: ローカル変数の総数 + 1。

:stack_max: スタックの深さ。(SystemStackError...
...いた場合は "<compiled>"。

: #absolute_path

命令シーケンスの絶対パス。文字列から作成していた場合は nil。

: #first_lineno

命令シーケンスの 1 行目の行番号。

: type

命令シーケンスの種別。
:top、:method、:block、:class、:rescue...
...の配列の配列。


//emlist[例][ruby]{
require 'pp'

iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
pp iseq.to_a
# ※ Ruby 2.5.0 での実行結果
# => ["YARVInstructionSequence/SimpleDataFormat",
# 2,
# 0,
# 1,
# {:arg_size=>0, :local_size=>2, :stack_max=>2},
# "<compiled>",
# "<...

REXML::Attributes#size -> Integer (15120.0)

属性の個数を返します。

...返します。


//emlist[][ruby]{
require 'rexml/document'

doc = REXML::Document.new(<<EOS)
<root xmlns:foo="http://example.org/foo"
xmlns:bar="http://example.org/bar">
<a foo:att='1' bar:att='2' att='&lt;'/>
</root>
EOS
a = doc.get_elements("/root/a").first

p a.attributes.length # => 3...

Object#enum_for(method = :each, *args) -> Enumerator (67.0)

Enumerator.new(self, method, *args) を返します。

...場合は Enumerator#size がブロックの評価結果を返
します。ブロックパラメータは引数 args です。


@param method メソッド名の文字列かシンボルです。
@param args 呼び出すメソッドに渡される引数です。

//emlist[][ruby]{
str = "xyz"

enum =...
...)][ruby]{
module Enumerable
def repeat(n)
raise ArgumentError, "#{n} is negative!" if n < 0
unless block_given?
# __method__ はここでは :repeat
return to_enum(__method__, n) do
# size メソッドが nil でなければ size * n を返す。
sz = size...
...each do |*val|
n.times { yield *val }
end
end
end

%i[hello world].repeat(2) { |w| puts w }
# => 'hello', 'hello', 'world', 'world'
enum = (1..14).repeat(3)
# => #<Enumerator: 1..14:repeat(3)>
enum.first(4) # => [1, 1, 1, 2]
enum.size # => 42
//}

@see Enumerator, Enumerator#size...

Object#enum_for(method = :each, *args) {|*args| ... } -> Enumerator (67.0)

Enumerator.new(self, method, *args) を返します。

...場合は Enumerator#size がブロックの評価結果を返
します。ブロックパラメータは引数 args です。


@param method メソッド名の文字列かシンボルです。
@param args 呼び出すメソッドに渡される引数です。

//emlist[][ruby]{
str = "xyz"

enum =...
...)][ruby]{
module Enumerable
def repeat(n)
raise ArgumentError, "#{n} is negative!" if n < 0
unless block_given?
# __method__ はここでは :repeat
return to_enum(__method__, n) do
# size メソッドが nil でなければ size * n を返す。
sz = size...
...each do |*val|
n.times { yield *val }
end
end
end

%i[hello world].repeat(2) { |w| puts w }
# => 'hello', 'hello', 'world', 'world'
enum = (1..14).repeat(3)
# => #<Enumerator: 1..14:repeat(3)>
enum.first(4) # => [1, 1, 1, 2]
enum.size # => 42
//}

@see Enumerator, Enumerator#size...

Object#to_enum(method = :each, *args) -> Enumerator (67.0)

Enumerator.new(self, method, *args) を返します。

...場合は Enumerator#size がブロックの評価結果を返
します。ブロックパラメータは引数 args です。


@param method メソッド名の文字列かシンボルです。
@param args 呼び出すメソッドに渡される引数です。

//emlist[][ruby]{
str = "xyz"

enum =...
...)][ruby]{
module Enumerable
def repeat(n)
raise ArgumentError, "#{n} is negative!" if n < 0
unless block_given?
# __method__ はここでは :repeat
return to_enum(__method__, n) do
# size メソッドが nil でなければ size * n を返す。
sz = size...
...each do |*val|
n.times { yield *val }
end
end
end

%i[hello world].repeat(2) { |w| puts w }
# => 'hello', 'hello', 'world', 'world'
enum = (1..14).repeat(3)
# => #<Enumerator: 1..14:repeat(3)>
enum.first(4) # => [1, 1, 1, 2]
enum.size # => 42
//}

@see Enumerator, Enumerator#size...

絞り込み条件を変える

Object#to_enum(method = :each, *args) {|*args| ... } -> Enumerator (67.0)

Enumerator.new(self, method, *args) を返します。

...場合は Enumerator#size がブロックの評価結果を返
します。ブロックパラメータは引数 args です。


@param method メソッド名の文字列かシンボルです。
@param args 呼び出すメソッドに渡される引数です。

//emlist[][ruby]{
str = "xyz"

enum =...
...)][ruby]{
module Enumerable
def repeat(n)
raise ArgumentError, "#{n} is negative!" if n < 0
unless block_given?
# __method__ はここでは :repeat
return to_enum(__method__, n) do
# size メソッドが nil でなければ size * n を返す。
sz = size...
...each do |*val|
n.times { yield *val }
end
end
end

%i[hello world].repeat(2) { |w| puts w }
# => 'hello', 'hello', 'world', 'world'
enum = (1..14).repeat(3)
# => #<Enumerator: 1..14:repeat(3)>
enum.first(4) # => [1, 1, 1, 2]
enum.size # => 42
//}

@see Enumerator, Enumerator#size...

String#[](range) -> String (60.0)

rangeで指定したインデックスの範囲に含まれる部分文字列を返します。

...

range.first が 0 より小さいか文字列の長さより大きいときは nil を
返します。ただし range.first および range.last のどちらか
または両方が負の数のときは一度だけ文字列の長さを足して
再試行します。

//emlist[例][ruby]{
'abcd'[...
...

range.first が 0 より小さいか文字列の長さより大きいときは nil を返します。
ただし range.first と range.last のどちらかまたは両方が負の数
であるときは一度だけ文字列の長さを足して再試行します。

//emlist[例][ruby]{
'abcd'[ 2...

String#slice(range) -> String (60.0)

rangeで指定したインデックスの範囲に含まれる部分文字列を返します。

...

range.first が 0 より小さいか文字列の長さより大きいときは nil を
返します。ただし range.first および range.last のどちらか
または両方が負の数のときは一度だけ文字列の長さを足して
再試行します。

//emlist[例][ruby]{
'abcd'[...
...

range.first が 0 より小さいか文字列の長さより大きいときは nil を返します。
ただし range.first と range.last のどちらかまたは両方が負の数
であるときは一度だけ文字列の長さを足して再試行します。

//emlist[例][ruby]{
'abcd'[ 2...

String#[](nth) -> String | nil (45.0)

nth 番目の文字を返します。 nth が負の場合は文字列の末尾から数えます。 つまり、 self.size + nth 番目の文字を返します。

...えます。
つまり、 self.size + nth 番目の文字を返します。

nth が範囲外を指す場合は nil を返します。

@param nth 文字の位置を表す整数
@return 指定した位置の文字を表す String オブジェクト

//emlist[例][ruby]{
p 'bar'[2] # => "r"
p '...
<< 1 2 3 > >>