別のキーワード
クラス
-
ARGF
. class (78) - Array (5)
- BasicObject (12)
- Class (7)
- Dir (6)
-
Enumerator
:: Lazy (1) - Exception (1)
- FalseClass (5)
- File (5)
- Hash (6)
- IO (5)
- Method (17)
- Module (51)
- NameError (1)
- NilClass (13)
- Object (39)
- Proc (1)
- Range (1)
- Regexp (1)
-
RubyVM
:: InstructionSequence (1) - Struct (4)
- Thread (3)
-
Thread
:: Backtrace :: Location (4) - TracePoint (4)
- TrueClass (5)
- UnboundMethod (4)
モジュール
- Enumerable (12)
- Kernel (13)
- Marshal (2)
- ObjectSpace (8)
キーワード
- ! (1)
- != (1)
-
$ FILENAME (1) - & (3)
- < (1)
- <=> (1)
- == (2)
- === (2)
- ARGF (1)
- FALSE (1)
- Method (1)
- NIL (1)
- Numeric (1)
- String (1)
- TRUE (1)
- [] (3)
- ^ (3)
-
_ _ send _ _ (2) -
_ dump (1) -
_ load (1) -
absolute
_ path (1) -
add
_ trace _ func (1) - allocate (1)
- ancestors (1)
-
append
_ features (1) - argv (1)
- arity (2)
- autoload (2)
- autoload? (1)
- backtrace (1)
-
base
_ label (1) - bind (1)
- binmode (1)
- binmode? (1)
- bytes (2)
- call (2)
-
callee
_ id (1) - chars (2)
-
class
_ eval (2) -
class
_ exec (1) -
class
_ variable _ defined? (1) -
class
_ variable _ get (1) -
class
_ variable _ set (1) -
class
_ variables (1) - clone (3)
- close (1)
- closed? (1)
- codepoints (2)
-
const
_ defined? (1) -
const
_ get (1) - constants (2)
-
count
_ objects (1) -
define
_ finalizer (2) -
define
_ method (2) -
define
_ singleton _ method (2) -
defined
_ class (1) - display (1)
- dump (2)
- dup (2)
- each (4)
-
each
_ byte (2) -
each
_ char (2) -
each
_ codepoint (2) -
each
_ entry (2) -
each
_ line (4) -
each
_ object (4) - eof (1)
- eof? (1)
- extend (1)
-
external
_ encoding (1) - fail (3)
- file (1)
- filename (1)
- fileno (1)
-
fixed
_ encoding? (1) -
for
_ fd (1) - getbyte (1)
- getc (1)
- gets (3)
-
global
_ variables (1) - include (1)
- include? (1)
- included (1)
- inherited (1)
- initialize (1)
-
initialize
_ copy (1) -
inplace
_ mode (1) - inspect (7)
-
instance
_ eval (2) -
instance
_ exec (1) -
instance
_ method (1) -
instance
_ methods (1) -
instance
_ of? (1) -
instance
_ variable _ defined? (1) -
instance
_ variable _ get (1) -
instance
_ variables (1) -
internal
_ encoding (1) -
is
_ a? (1) -
kind
_ of? (1) - lambda? (1)
- lineno (1)
- lines (6)
-
local
_ variables (1) -
marshal
_ dump (1) -
marshal
_ load (1) - max (4)
- merge (2)
-
method
_ added (1) -
method
_ defined? (1) -
method
_ id (1) -
method
_ missing (1) -
method
_ removed (1) -
method
_ undefined (1) - methods (1)
- min (4)
-
module
_ eval (2) -
module
_ exec (1) - name (2)
- nesting (1)
- new (13)
- nil? (1)
- open (8)
-
original
_ name (2) - owner (2)
- parameters (1)
- path (2)
- pos (1)
- prepend (1)
-
prepend
_ features (1) - prepended (1)
- print (1)
- printf (1)
- private (1)
-
private
_ class _ method (1) -
private
_ constant (1) -
private
_ method _ defined? (1) -
protected
_ method _ defined? (1) -
public
_ class _ method (1) -
public
_ constant (1) -
public
_ method (1) -
public
_ method _ defined? (1) - putc (1)
- puts (1)
- raise (3)
- rationalize (2)
- read (1)
-
read
_ nonblock (1) - readbyte (2)
- readchar (1)
- readline (3)
- readlines (3)
- readpartial (1)
- receiver (2)
- refine (1)
-
remove
_ class _ variable (1) -
remove
_ const (1) -
remove
_ instance _ variable (1) -
remove
_ method (1) - replace (1)
-
respond
_ to? (1) -
respond
_ to _ missing? (1) - rewind (1)
- seek (1)
- send (2)
-
set
_ encoding (3) -
set
_ trace _ func (2) -
singleton
_ class (1) -
singleton
_ class? (1) -
singleton
_ method (1) -
singleton
_ method _ added (1) -
singleton
_ method _ removed (1) -
singleton
_ method _ undefined (1) -
singleton
_ methods (1) - skip (1)
-
sort
_ by (2) -
source
_ location (1) - stat (1)
-
super
_ method (1) - superclass (1)
- tell (1)
-
to
_ a (6) -
to
_ ary (2) -
to
_ c (1) -
to
_ f (1) -
to
_ h (2) -
to
_ hash (1) -
to
_ i (2) -
to
_ int (1) -
to
_ io (1) -
to
_ proc (2) -
to
_ r (1) -
to
_ regexp (1) -
to
_ s (8) -
to
_ str (1) -
to
_ write _ io (1) - unbind (1)
-
undef
_ method (1) -
undefine
_ finalizer (1) - write (1)
- | (3)
検索結果
先頭5件
-
RubyVM
:: InstructionSequence # to _ a -> Array (325.0) -
self の情報を 14 要素の配列にして返します。
...ンドの配列の配列。
//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>"... -
Struct
. [](*args) -> Struct (325.0) -
(このメソッドは Struct の下位クラスにのみ定義されています) 構造体オブジェクトを生成して返します。
(このメソッドは Struct の下位クラスにのみ定義されています)
構造体オブジェクトを生成して返します。
@param args 構造体の初期値を指定します。メンバの初期値は指定されなければ nil です。
@return 構造体クラスのインスタンス。
@raise ArgumentError 構造体のメンバの数よりも多くの引数を指定した場合に発生します。
//emlist[例][ruby]{
Foo = Struct.new(:foo, :bar)
foo = Foo.new(1)
p foo.values # => [1, nil]
//} -
Struct
. new(*args) -> Struct (325.0) -
(このメソッドは Struct の下位クラスにのみ定義されています) 構造体オブジェクトを生成して返します。
(このメソッドは Struct の下位クラスにのみ定義されています)
構造体オブジェクトを生成して返します。
@param args 構造体の初期値を指定します。メンバの初期値は指定されなければ nil です。
@return 構造体クラスのインスタンス。
@raise ArgumentError 構造体のメンバの数よりも多くの引数を指定した場合に発生します。
//emlist[例][ruby]{
Foo = Struct.new(:foo, :bar)
foo = Foo.new(1)
p foo.values # => [1, nil]
//} -
Thread
# backtrace -> [String] | nil (325.0) -
スレッドの現在のバックトレースを返します。
スレッドの現在のバックトレースを返します。
スレッドがすでに終了している場合は nil を返します。
//emlist[例][ruby]{
class C1
def m1
sleep 5
end
def m2
m1
end
end
th = Thread.new {C1.new.m2; Thread.stop}
th.backtrace
# => [
# [0] "(irb):3:in `sleep'",
# [1] "(irb):3:in `m1'",
# [2] "(irb):6:in `m2'",
# [3] ... -
Thread
:: Backtrace :: Location # absolute _ path -> String (325.0) -
self が表すフレームの絶対パスを返します。
self が表すフレームの絶対パスを返します。
//emlist[例][ruby]{
# foo.rb
class Foo
attr_accessor :locations
def initialize(skip)
@locations = caller_locations(skip)
end
end
Foo.new(0..2).locations.map do |call|
puts call.absolute_path
end
# => /path/to/foo.rb
# /path/to/foo.rb
# /path/to/foo.rb
//}
@see... -
Thread
:: Backtrace :: Location # inspect -> String (325.0) -
Thread::Backtrace::Location#to_s の結果を人間が読みやすいような文 字列に変換したオブジェクトを返します。
Thread::Backtrace::Location#to_s の結果を人間が読みやすいような文
字列に変換したオブジェクトを返します。
//emlist[例][ruby]{
# foo.rb
class Foo
attr_accessor :locations
def initialize(skip)
@locations = caller_locations(skip)
end
end
Foo.new(0..2).locations.map do |call|
puts call.inspect
end
# => "path/to/foo.rb:5:in ... -
Thread
:: Backtrace :: Location # to _ s -> String (325.0) -
self が表すフレームを Kernel.#caller と同じ表現にした文字列を返し ます。
self が表すフレームを Kernel.#caller と同じ表現にした文字列を返し
ます。
//emlist[例][ruby]{
# foo.rb
class Foo
attr_accessor :locations
def initialize(skip)
@locations = caller_locations(skip)
end
end
Foo.new(0..2).locations.map do |call|
puts call.to_s
end
# => path/to/foo.rb:5:in `initialize'
# path/to/foo... -
TracePoint
# callee _ id -> Symbol | nil (325.0) -
イベントが発生したメソッドの呼ばれた名前を Symbol で返します。 トップレベルであった場合は nil を返します。
イベントが発生したメソッドの呼ばれた名前を Symbol で返します。
トップレベルであった場合は nil を返します。
@raise RuntimeError イベントフックの外側で実行した場合に発生します。
//emlist[][ruby]{
class C
def method_name
end
alias alias_name method_name
end
trace = TracePoint.new(:call) do |tp|
p [tp.method_id, tp.callee_id] # => [:method_name, :alias_name]
e... -
TracePoint
# method _ id -> Symbol | nil (325.0) -
イベントが発生したメソッドの定義時の名前を Symbol で返します。 トップレベルであった場合は nil を返します。
イベントが発生したメソッドの定義時の名前を Symbol で返します。
トップレベルであった場合は nil を返します。
@raise RuntimeError イベントフックの外側で実行した場合に発生します。
//emlist[][ruby]{
class C
def method_name
end
alias alias_name method_name
end
trace = TracePoint.new(:call) do |tp|
p [tp.method_id, tp.callee_id] # => [:method_name, :alias_name]
e... -
UnboundMethod
# arity -> Integer (325.0) -
メソッドが受け付ける引数の数を返します。
メソッドが受け付ける引数の数を返します。
ただし、メソッドが可変長引数を受け付ける場合、負の整数
-(必要とされる引数の数 + 1)
を返します。C 言語レベルで実装されたメソッドが可変長引数を
受け付ける場合、-1 を返します。
//emlist[例][ruby]{
class C
def one; end
def two(a); end
def three(*a); end
def four(a, b); end
def five(a, b, *c); end
def six(a, b, *c, &d); end
end
p C.insta... -
UnboundMethod
# original _ name -> Symbol (325.0) -
オリジナルのメソッド名を返します。
オリジナルのメソッド名を返します。
//emlist[例][ruby]{
class C
def foo; end
alias bar foo
end
C.instance_method(:bar).original_name # => :foo
//}
@see Method#original_name -
Enumerable
# max -> object | nil (316.0) -
最大の要素、もしくは最大の n 要素が入った降順の配列を返します。 全要素が互いに <=> メソッドで比較できることを仮定しています。
最大の要素、もしくは最大の n 要素が入った降順の配列を返します。
全要素が互いに <=> メソッドで比較できることを仮定しています。
引数を指定しない形式では要素が存在しなければ nil を返します。
引数を指定する形式では、空の配列を返します。
該当する要素が複数存在する場合、どの要素を返すかは不定です。
@param n 取得する要素数。
//emlist[例][ruby]{
a = %w(albatross dog horse)
a.max # => "horse"
a.max(2) # =>... -
Enumerable
# max(n) -> Array (316.0) -
最大の要素、もしくは最大の n 要素が入った降順の配列を返します。 全要素が互いに <=> メソッドで比較できることを仮定しています。
最大の要素、もしくは最大の n 要素が入った降順の配列を返します。
全要素が互いに <=> メソッドで比較できることを仮定しています。
引数を指定しない形式では要素が存在しなければ nil を返します。
引数を指定する形式では、空の配列を返します。
該当する要素が複数存在する場合、どの要素を返すかは不定です。
@param n 取得する要素数。
//emlist[例][ruby]{
a = %w(albatross dog horse)
a.max # => "horse"
a.max(2) # =>... -
Enumerable
# min -> object | nil (316.0) -
最小の要素、もしくは最小の n 要素が昇順で入った配列を返します。 全要素が互いに <=> メソッドで比較できることを仮定しています。
最小の要素、もしくは最小の n 要素が昇順で入った配列を返します。
全要素が互いに <=> メソッドで比較できることを仮定しています。
引数を指定しない形式では要素が存在しなければ nil を返します。
引数を指定する形式では、空の配列を返します。
該当する要素が複数存在する場合、どの要素を返すかは不定です。
@param n 取得する要素数。
//emlist[例][ruby]{
a = %w(albatross dog horse)
a.min # => "albatross"
a.min(2) ... -
Enumerable
# min(n) -> Array (316.0) -
最小の要素、もしくは最小の n 要素が昇順で入った配列を返します。 全要素が互いに <=> メソッドで比較できることを仮定しています。
最小の要素、もしくは最小の n 要素が昇順で入った配列を返します。
全要素が互いに <=> メソッドで比較できることを仮定しています。
引数を指定しない形式では要素が存在しなければ nil を返します。
引数を指定する形式では、空の配列を返します。
該当する要素が複数存在する場合、どの要素を返すかは不定です。
@param n 取得する要素数。
//emlist[例][ruby]{
a = %w(albatross dog horse)
a.min # => "albatross"
a.min(2) ... -
Method (97.0)
-
Object#method によりオブジェクト化され たメソッドオブジェクトのクラスです。
Object#method によりオブジェクト化され
たメソッドオブジェクトのクラスです。
メソッドの実体(名前でなく)とレシーバの組を封入します。
Proc オブジェクトと違ってコンテキストを保持しません。
=== Proc との差
Method は取り出しの対象であるメソッドが
なければ作れませんが、Proc は準備なしに作れます。その点から
Proc は使い捨てに向き、Method は何度も繰り返し生成する
場合に向くと言えます。また内包するコードの大きさという点では
Proc は小規模、Method は大規模コードに向くと言えます。
既存のメソッドを Method オブジェク... -
Numeric (79.0)
-
数値を表す抽象クラスです。Integer や Float などの数値クラス は Numeric のサブクラスとして実装されています。
数値を表す抽象クラスです。Integer や Float などの数値クラス
は Numeric のサブクラスとして実装されています。
演算や比較を行うメソッド(+, -, *, /, <=>)は Numeric のサブクラスで定義されま
す。Numeric で定義されているメソッドは、サブクラスで提供されているメソッド
(+, -, *, /, %) を利用して定義されるものがほとんどです。
つまり Numeric で定義されているメソッドは、Numeric のサブクラスとして新たに数値クラスを定義した時に、
演算メソッド(+, -, *, /, %, <=>, coerce)だけを定義すれ...