ライブラリ
- ビルトイン (225)
クラス
- Array (16)
- BasicObject (22)
- Enumerator (88)
-
Enumerator
:: Yielder (11) - Method (22)
- Object (44)
- Regexp (22)
キーワード
- each (44)
- extend (11)
-
initialize
_ copy (11) - inspect (11)
- match (22)
- methods (11)
- pack (16)
-
singleton
_ method _ removed (11) -
singleton
_ method _ undefined (11) -
singleton
_ methods (11) -
to
_ s (11) -
with
_ index (22) -
with
_ object (22)
検索結果
先頭5件
-
Enumerator
:: Yielder # <<(object) -> () (26153.0) -
Enumerator.new で使うメソッドです。
...merator.new で使うメソッドです。
生成された Enumerator オブジェクトの each メソッドを呼ぶと
Enumerator::Yielder オブジェクトが渡されたブロックが実行され、
ブロック内の << が呼ばれるたびに each に渡されたブロックが
<< に渡......された値とともに繰り返されます。
//emlist[例][ruby]{
enum = Enumerator.new do |y|
y << 1
y << 2
y << 3
end
enum.each do |v|
p v
end
# => 1
# 2
# 3
//}... -
Array
# pack(template , buffer: String . new) -> String (8132.0) -
配列の内容を template で指定された文字列にしたがって、 バイナリとしてパックした文字列を返します。
...sgn * Inf # ±∞ (positive/negative infinity)
else
NaN # 非数 (not a number)
end
else
fra += 1 << 23 # ゲタ
sgn * fra * 2**(exp-127-23) # 正規化数 (normalized number)
end
//}
: G
ビッグエンディアンの倍精......sgn * Inf # ±∞ (positive/negative infinity)
else
NaN # 非数 (not a number)
end
else
fra += 1 << 52 # ゲタ
sgn * fra * 2**(exp-1023-52) # 正規化数 (normalized number)
end
//}
: p
ヌル終端の文字列へのポイ......82, 117, 98, 121].pack("c*") # => "Ruby"
s = ""
[82, 117, 98, 121].each {|c| s << c}
s # => "Ruby"
[82, 117, 98, 121].collect {|c| sprintf "%c", c}.join # => "Ruby"
[82, 117, 98, 121].inject("") {|s, c| s << c} # => "Ruby"
//}
: 文字列を数値(文字コード)の配列に変換す... -
Object
# singleton _ methods(inherited _ too = true) -> [Symbol] (8037.0) -
そのオブジェクトに対して定義されている特異メソッド名 (public あるいは protected メソッド) の一覧を返します。
...定します。
//emlist[例1][ruby]{
Parent = Class.new
class <<Parent
private; def private_class_parent() end
protected; def protected_class_parent() end
public; def public_class_parent() end
end
Foo = Class.new(Parent)
class <<Foo
private; def private_class_foo() end
protecte......d
end
module Bar
private; def private_bar() end
protected; def protected_bar() end
public; def public_bar() end
end
obj = Foo.new
class <<obj
include Bar
private; def private_self() end
protected; def protected_self() end
public; def public_self() end
end
# あ... -
Array
# pack(template) -> String (8032.0) -
配列の内容を template で指定された文字列にしたがって、 バイナリとしてパックした文字列を返します。
...sgn * Inf # ±∞ (positive/negative infinity)
else
NaN # 非数 (not a number)
end
else
fra += 1 << 23 # ゲタ
sgn * fra * 2**(exp-127-23) # 正規化数 (normalized number)
end
//}
: G
ビッグエンディアンの倍精......sgn * Inf # ±∞ (positive/negative infinity)
else
NaN # 非数 (not a number)
end
else
fra += 1 << 52 # ゲタ
sgn * fra * 2**(exp-1023-52) # 正規化数 (normalized number)
end
//}
: p
ヌル終端の文字列へのポイ......82, 117, 98, 121].pack("c*") # => "Ruby"
s = ""
[82, 117, 98, 121].each {|c| s << c}
s # => "Ruby"
[82, 117, 98, 121].collect {|c| sprintf "%c", c}.join # => "Ruby"
[82, 117, 98, 121].inject("") {|s, c| s << c} # => "Ruby"
//}
: 文字列を数値(文字コード)の配列に変換す... -
Method
# inspect -> String (8025.0) -
self を読みやすい文字列として返します。
...。
//emlist[例][ruby]{
module Foo
def foo
"foo"
end
end
class Bar
include Foo
def bar
end
end
p Bar.new.method(:foo) # => #<Method: Bar(Foo)#foo>
p Bar.new.method(:bar) # => #<Method: Bar#bar>
//}
klass1 と klass2 が同じ場合は以下の形式になります。......メソッドを定義しているオブジェクトになります。
//emlist[例][ruby]{
# オブジェクトの特異メソッド
obj = ""
class <<obj
def foo
end
end
p obj.method(:foo) # => #<Method: "".foo>
# クラスメソッド(クラスの特異メソッド)
class Foo
def Foo.f......# スーパークラスのクラスメソッド
class Bar < Foo
end
p Bar.method(:foo) # => #<Method: Bar.foo>
# 以下は(形式1)の出力になる
module Baz
def baz
end
end
class <<obj
include Baz
end
p obj.method(:baz) # => #<Method: Object(Baz)#baz>
//}
@see Object#inspect......st[例][ruby]{
module Foo
def foo
"foo"
end
end
class Bar
include Foo
def bar(a, b)
end
end
p Bar.new.method(:foo) # => #<Method: Bar(Foo)#foo() test.rb:2>
p Bar.new.method(:bar) # => #<Method: Bar#bar(a, b) test.rb:8>
//}
klass1 と klass2 が同じ場合は以下の......メソッドを定義しているオブジェクトになります。
//emlist[例][ruby]{
# オブジェクトの特異メソッド
obj = ""
class <<obj
def foo
end
end
p obj.method(:foo) # => #<Method: "".foo() foo.rb:4>
# クラスメソッド(クラスの特異メソッド)
class Foo......ラスメソッド
class Bar < Foo
end
p Bar.method(:foo) # => #<Method: Bar(Foo).foo() foo.rb:11>
# 以下は(形式1)の出力になる
module Baz
def baz
end
end
class <<obj
include Baz
end
p obj.method(:baz) # => #<Method: String(Baz)#baz() foo.rb:23>
//}
@see Object#inspect... -
Method
# to _ s -> String (8025.0) -
self を読みやすい文字列として返します。
...。
//emlist[例][ruby]{
module Foo
def foo
"foo"
end
end
class Bar
include Foo
def bar
end
end
p Bar.new.method(:foo) # => #<Method: Bar(Foo)#foo>
p Bar.new.method(:bar) # => #<Method: Bar#bar>
//}
klass1 と klass2 が同じ場合は以下の形式になります。......メソッドを定義しているオブジェクトになります。
//emlist[例][ruby]{
# オブジェクトの特異メソッド
obj = ""
class <<obj
def foo
end
end
p obj.method(:foo) # => #<Method: "".foo>
# クラスメソッド(クラスの特異メソッド)
class Foo
def Foo.f......# スーパークラスのクラスメソッド
class Bar < Foo
end
p Bar.method(:foo) # => #<Method: Bar.foo>
# 以下は(形式1)の出力になる
module Baz
def baz
end
end
class <<obj
include Baz
end
p obj.method(:baz) # => #<Method: Object(Baz)#baz>
//}
@see Object#inspect......st[例][ruby]{
module Foo
def foo
"foo"
end
end
class Bar
include Foo
def bar(a, b)
end
end
p Bar.new.method(:foo) # => #<Method: Bar(Foo)#foo() test.rb:2>
p Bar.new.method(:bar) # => #<Method: Bar#bar(a, b) test.rb:8>
//}
klass1 と klass2 が同じ場合は以下の......メソッドを定義しているオブジェクトになります。
//emlist[例][ruby]{
# オブジェクトの特異メソッド
obj = ""
class <<obj
def foo
end
end
p obj.method(:foo) # => #<Method: "".foo() foo.rb:4>
# クラスメソッド(クラスの特異メソッド)
class Foo......ラスメソッド
class Bar < Foo
end
p Bar.method(:foo) # => #<Method: Bar(Foo).foo() foo.rb:11>
# 以下は(形式1)の出力になる
module Baz
def baz
end
end
class <<obj
include Baz
end
p obj.method(:baz) # => #<Method: String(Baz)#baz() foo.rb:23>
//}
@see Object#inspect... -
Enumerator
# each -> self (8019.0) -
生成時のパラメータに従ってブロックを繰り返します。 *args を渡した場合は、生成時のパラメータ内引数末尾へ *args を追加した状態で繰り返します。 ブロック付きで呼び出された場合は、 生成時に指定したイテレータの戻り値をそのまま返します。
...返します。
@param args 末尾へ追加する引数
//emlist[例1][ruby]{
str = "Yet Another Ruby Hacker"
enum = Enumerator.new {|y| str.scan(/\w+/) {|w| y << w }}
enum.each {|word| p word } # => "Yet"
# "Another"......orld!".to_enum(:scan, /\w+/).to_a # => ["Hello", "world"]
"Hello, world!".to_enum(:scan).each(/\w+/).to_a # => ["Hello", "world"]
obj = Object.new
def obj.each_arg(a, b=:b, *rest)
yield a
yield b
yield rest
:method_returned
end
enum = obj.to_enum :each_arg, :a, :x
enum.each.to_a... -
Enumerator
# each { . . . } -> object (8019.0) -
生成時のパラメータに従ってブロックを繰り返します。 *args を渡した場合は、生成時のパラメータ内引数末尾へ *args を追加した状態で繰り返します。 ブロック付きで呼び出された場合は、 生成時に指定したイテレータの戻り値をそのまま返します。
...返します。
@param args 末尾へ追加する引数
//emlist[例1][ruby]{
str = "Yet Another Ruby Hacker"
enum = Enumerator.new {|y| str.scan(/\w+/) {|w| y << w }}
enum.each {|word| p word } # => "Yet"
# "Another"......orld!".to_enum(:scan, /\w+/).to_a # => ["Hello", "world"]
"Hello, world!".to_enum(:scan).each(/\w+/).to_a # => ["Hello", "world"]
obj = Object.new
def obj.each_arg(a, b=:b, *rest)
yield a
yield b
yield rest
:method_returned
end
enum = obj.to_enum :each_arg, :a, :x
enum.each.to_a... -
Enumerator
# each(*args) -> Enumerator (8019.0) -
生成時のパラメータに従ってブロックを繰り返します。 *args を渡した場合は、生成時のパラメータ内引数末尾へ *args を追加した状態で繰り返します。 ブロック付きで呼び出された場合は、 生成時に指定したイテレータの戻り値をそのまま返します。
...返します。
@param args 末尾へ追加する引数
//emlist[例1][ruby]{
str = "Yet Another Ruby Hacker"
enum = Enumerator.new {|y| str.scan(/\w+/) {|w| y << w }}
enum.each {|word| p word } # => "Yet"
# "Another"......orld!".to_enum(:scan, /\w+/).to_a # => ["Hello", "world"]
"Hello, world!".to_enum(:scan).each(/\w+/).to_a # => ["Hello", "world"]
obj = Object.new
def obj.each_arg(a, b=:b, *rest)
yield a
yield b
yield rest
:method_returned
end
enum = obj.to_enum :each_arg, :a, :x
enum.each.to_a... -
Enumerator
# each(*args) { . . . } -> object (8019.0) -
生成時のパラメータに従ってブロックを繰り返します。 *args を渡した場合は、生成時のパラメータ内引数末尾へ *args を追加した状態で繰り返します。 ブロック付きで呼び出された場合は、 生成時に指定したイテレータの戻り値をそのまま返します。
...返します。
@param args 末尾へ追加する引数
//emlist[例1][ruby]{
str = "Yet Another Ruby Hacker"
enum = Enumerator.new {|y| str.scan(/\w+/) {|w| y << w }}
enum.each {|word| p word } # => "Yet"
# "Another"......orld!".to_enum(:scan, /\w+/).to_a # => ["Hello", "world"]
"Hello, world!".to_enum(:scan).each(/\w+/).to_a # => ["Hello", "world"]
obj = Object.new
def obj.each_arg(a, b=:b, *rest)
yield a
yield b
yield rest
:method_returned
end
enum = obj.to_enum :each_arg, :a, :x
enum.each.to_a...