別のキーワード
ライブラリ
- ビルトイン (384)
- erb (12)
-
fiddle
/ import (12) - forwardable (48)
- json (12)
- win32ole (24)
クラス
- BasicObject (84)
- Class (24)
- ERB (12)
- Object (132)
-
Thread
:: Backtrace :: Location (48) -
WIN32OLE
_ EVENT (12) -
WIN32OLE
_ TYPE (12)
モジュール
- Enumerable (96)
-
Fiddle
:: Importer (12) - Forwardable (48)
-
JSON
:: Generator :: GeneratorMethods :: Object (12)
キーワード
- ! (12)
- != (12)
- == (12)
-
_ dump (12) -
absolute
_ path (12) - allocate (12)
-
base
_ label (12) - clone (12)
-
def
_ class (12) -
def
_ delegator (12) -
def
_ instance _ delegator (12) -
default
_ event _ sources (12) - delegate (12)
- dup (12)
- handler= (12)
-
initialize
_ copy (12) - inspect (24)
-
instance
_ delegate (12) -
instance
_ eval (24) -
instance
_ exec (12) -
instance
_ variable _ defined? (12) -
instance
_ variable _ get (12) -
marshal
_ dump (12) - max (48)
-
method
_ missing (12) - min (48)
- new (12)
-
singleton
_ method (12) - struct (12)
-
to
_ json (12) -
to
_ s (24)
検索結果
先頭5件
-
Thread
:: Backtrace :: Location # to _ s -> String (25.0) -
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.rb:9:in `new'
# path/to... -
Enumerable
# max {|a , b| . . . } -> object | nil (21.0) -
ブロックの評価結果で各要素の大小判定を行い、最大の要素、もしくは最大の n 要素が入った降順の配列を返します。 引数を指定しない形式では要素が存在しなければ nil を返します。 引数を指定する形式では、空の配列を返します。
...る要素数。
@raise TypeError ブロックが整数以外を返したときに発生します。
//emlist[例][ruby]{
class Person
attr_reader :name, :age
def initialize(name, age)
@name = name
@age = age
end
end
people = [
Person.new("sato", 55),
Person.new("sato", 33),... -
Enumerable
# max(n) {|a , b| . . . } -> Array (21.0) -
ブロックの評価結果で各要素の大小判定を行い、最大の要素、もしくは最大の n 要素が入った降順の配列を返します。 引数を指定しない形式では要素が存在しなければ nil を返します。 引数を指定する形式では、空の配列を返します。
...る要素数。
@raise TypeError ブロックが整数以外を返したときに発生します。
//emlist[例][ruby]{
class Person
attr_reader :name, :age
def initialize(name, age)
@name = name
@age = age
end
end
people = [
Person.new("sato", 55),
Person.new("sato", 33),... -
Enumerable
# min {|a , b| . . . } -> object | nil (21.0) -
ブロックの評価結果で各要素の大小判定を行い、最小の要素、もしくは最小の n 要素が昇順で入った配列を返します。 引数を指定しない形式では要素が存在しなければ nil を返します。 引数を指定する形式では、空の配列を返します。
...数存在する場合、どの要素を返すかは不定です。
@param n 取得する要素数。
//emlist[例][ruby]{
class Person
attr_reader :name, :age
def initialize(name, age)
@name = name
@age = age
end
end
people = [
Person.new("sato", 55),
Person.new("sato", 33),... -
Enumerable
# min(n) {|a , b| . . . } -> Array (21.0) -
ブロックの評価結果で各要素の大小判定を行い、最小の要素、もしくは最小の n 要素が昇順で入った配列を返します。 引数を指定しない形式では要素が存在しなければ nil を返します。 引数を指定する形式では、空の配列を返します。
...数存在する場合、どの要素を返すかは不定です。
@param n 取得する要素数。
//emlist[例][ruby]{
class Person
attr_reader :name, :age
def initialize(name, age)
@name = name
@age = age
end
end
people = [
Person.new("sato", 55),
Person.new("sato", 33),... -
BasicObject
# !=(other) -> bool (19.0) -
オブジェクトが other と等しくないことを判定します。
...います。
@param other 比較対象となるオブジェクト
@see BasicObject#==, BasicObject#!
//emlist[例][ruby]{
class NonequalityRecorder < BasicObject
def initialize
@count = 0
end
attr_reader :count
def !=(other)
@count += 1
super
end
end
recorder = NonequalityRe... -
BasicObject
# ==(other) -> bool (19.0) -
オブジェクトが other と等しければ真を、そうでない場合は偽を返します。
...象となるオブジェクト
@return other が self と同値であれば真、そうでない場合は偽
//emlist[例][ruby]{
class Person < BasicObject
def initialize(name, age)
@name = name
@age = age
end
end
tanaka1 = Person.new("tanaka", 24)
tanaka2 = Person.new("tanaka", 24)... -
BasicObject
# instance _ exec(*args) {|*vars| . . . } -> object (19.0) -
与えられたブロックをレシーバのコンテキストで実行します。
...数にアクセスすることができます。
@param args ブロックパラメータに渡す値です。
//emlist[例][ruby]{
class KlassWithSecret
def initialize
@secret = 99
end
end
k = KlassWithSecret.new
# 以下で x には 5 が渡される
k.instance_exec(5) {|x| @secret + x }... -
Class
# allocate -> object (19.0) -
自身のインスタンスを生成して返します。生成したオブジェクトは 自身のインスタンスであること以外には何も特性を持ちません。
...ェクトは
自身のインスタンスであること以外には何も特性を持ちません。
//emlist[例][ruby]{
klass = Class.new do
def initialize(*args)
@initialized = true
end
def initialized?
@initialized || false
end
end
klass.allocate.initialized? #=> false
//}...