るりまサーチ

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

別のキーワード

  1. openssl new
  2. _builtin new
  3. rexml/document new
  4. resolv new
  5. socket new

クラス

モジュール

キーワード

検索結果

<< 1 2 3 ... > >>

Class#new(*args, &block) -> object (18134.0)

自身のインスタンスを生成して返します。 このメソッドの引数はブロック引数も含め Object#initialize に渡されます。

...引数も含め Object#initialize に渡されます。

new
は Class#allocate でインスタンスを生成し、
Object#initialize で初期化を行います。

@
param args Object#initialize に渡される引数を指定します。

@
param block Object#initialize に渡されるブロック...
...を指定します。

//emlist[例][ruby]{
# Class クラスのインスタンス、C クラスを生成
C = Class.new # => C

# Class クラスのインスタンス、C クラスのインスタンスを生成
C.new # => #<C:0x00005623f8b4e458>
//}...

Array#pack(template, buffer: String.new) -> String (146.0)

配列の内容を template で指定された文字列にしたがって、 バイナリとしてパックした文字列を返します。

...

buffer が指定されていれば、バッファとして使って返値として返します。
もし template の最初にオフセット (@) が指定されていれば、
結果はオフセットの後ろから詰められます。
buffer の元の内容がオフセットより長けれ...
...す。

//emlist[例][ruby]{
['!'].pack('@1a', buffer: 'abc') # => "a!"
['!'].pack('@5a', buffer: 'abc') # => "abc\u0000\u0000!"
//}

@
param template 自身のバイナリとしてパックするためのテンプレートを文字列で指定します。
@
param buffer 結果を詰めるバッ...
...jZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXpBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWg==".unpack("m0")
# => ["abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"]
//}
@
see base64

: M

quoted-printable encoding された文字列
//emlist[][ruby]{
["a b c\td \ne"].pack("M") # => "a b c\td =\n\ne=\n"

"a b c\td =\n...

Module#alias_method(new, original) -> Symbol (134.0)

メソッドの別名を定義します。

...できません。

@
param new 新しいメソッド名。String または Symbol で指定します。

@
param original 元のメソッド名。String または Symbol で指定します。

@
return 作成したエイリアスのメソッド名を表す Symbol を返します。

@
see d:spec/def#al...

Module#alias_method(new, original) -> self (134.0)

メソッドの別名を定義します。

...して使用することはできません。

@
param new 新しいメソッド名。String または Symbol で指定します。

@
param original 元のメソッド名。String または Symbol で指定します。

@
return self を返します。

@
see d:spec/def#alias

//emlist[例][ruby]{
modu...

Thread#report_on_exception=(newstate) (127.0)

真の場合、そのスレッドが例外によって終了した時に、その内容を $stderr に報告します。

...レッド作成時の Thread.report_on_exception です。

@
param newstate スレッド実行中に例外発生した場合、その内容を報告するかどうかを true か false で指定します。

//emlist[例][ruby]{
a = Thread.new{ Thread.stop; raise }
a.report_on_exception = true
a.rep...
...n
# => #<Thread:0x00007fc3f48c7908@(irb):1 run> terminated with exception (report_on_exception is true):
# Traceback (most recent call last):
# (irb):1:in `block in irb_binding': unhandled exception
# #<Thread:0x00007fc3f48c7908@(irb):1 dead>
b = Thread.new{ Thread.stop; raise }
b.report_on...
..._exception = false
b.run # => #<Thread:0x00007fc3f48aefc0@(irb):4 dead>
//}

@
see Thread.report_on_exception...

絞り込み条件を変える

IO#sync=(newstate) (121.0)

自身を同期モードに設定すると、出力関数の呼出毎にバッファがフラッシュされます。

...自身を同期モードに設定すると、出力関数の呼出毎にバッファがフラッシュされます。

@
param newstate 自身を同期モードに設定するかを boolean で指定します。

@
raise IOError 既に close されていた場合に発生します。

@
see IO#sync...

Enumerable#max {|a, b| ... } -> object | nil (118.0)

ブロックの評価結果で各要素の大小判定を行い、最大の要素、もしくは最大の n 要素が入った降順の配列を返します。 引数を指定しない形式では要素が存在しなければ nil を返します。 引数を指定する形式では、空の配列を返します。

...です。

@
param n 取得する要素数。

@
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),
Person.new("sato", 11),
Person.new("suzuki", 55),
Person.new("suzuki", 33),
Person.new("suzuki", 11),
Person.new("tanaka", 55),
Person.new("tanaka", 33),
Person.new("tanaka", 11)
]

# 年齢が最大、名前が最小
people.max { |x, y| (x.age <=> y.age).n...
...onzero? || y.name <=> x.name }
# => #<Person:0x007fc54b0240a0 @name="sato", @age=55>
people.max(2) { |x, y| (x.age <=> y.age).nonzero? || y.name <=> x.name }
# => [#<Person:0x007fc54b0240a0 @name="sato", @age=55>, #<Person:0x007fc54c033ea0 @name="suzuki", @age=55>]
//}...

Enumerable#max(n) {|a, b| ... } -> Array (118.0)

ブロックの評価結果で各要素の大小判定を行い、最大の要素、もしくは最大の n 要素が入った降順の配列を返します。 引数を指定しない形式では要素が存在しなければ nil を返します。 引数を指定する形式では、空の配列を返します。

...です。

@
param n 取得する要素数。

@
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),
Person.new("sato", 11),
Person.new("suzuki", 55),
Person.new("suzuki", 33),
Person.new("suzuki", 11),
Person.new("tanaka", 55),
Person.new("tanaka", 33),
Person.new("tanaka", 11)
]

# 年齢が最大、名前が最小
people.max { |x, y| (x.age <=> y.age).n...
...onzero? || y.name <=> x.name }
# => #<Person:0x007fc54b0240a0 @name="sato", @age=55>
people.max(2) { |x, y| (x.age <=> y.age).nonzero? || y.name <=> x.name }
# => [#<Person:0x007fc54b0240a0 @name="sato", @age=55>, #<Person:0x007fc54c033ea0 @name="suzuki", @age=55>]
//}...

Enumerable#min {|a, b| ... } -> object | nil (118.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),
Person.new("sato", 11),
Person.new("suzuki", 55),
Person.new(...
...zuki", 33),
Person.new("suzuki", 11),
Person.new("tanaka", 55),
Person.new("tanaka", 33),
Person.new("tanaka", 11)
]

# 年齢が最小、名前が最大
people.min { |x, y| (x.age <=> y.age).nonzero? || y.name <=> x.name }
# => #<Person:0x007fd6f0824190 @name="tanaka", @age=11>

people.min(...
...2) { |x, y| (x.age <=> y.age).nonzero? || y.name <=> x.name }
# => [#<Person:0x007fb5899ef4a8 @name="tanaka", @age=11>, #<Person:0x007fb5899ef728 @name="suzuki", @age=11>]
//}

@
raise TypeError ブロックが整数以外を返したときに発生します。...

Enumerable#min(n) {|a, b| ... } -> Array (118.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),
Person.new("sato", 11),
Person.new("suzuki", 55),
Person.new(...
...zuki", 33),
Person.new("suzuki", 11),
Person.new("tanaka", 55),
Person.new("tanaka", 33),
Person.new("tanaka", 11)
]

# 年齢が最小、名前が最大
people.min { |x, y| (x.age <=> y.age).nonzero? || y.name <=> x.name }
# => #<Person:0x007fd6f0824190 @name="tanaka", @age=11>

people.min(...
...2) { |x, y| (x.age <=> y.age).nonzero? || y.name <=> x.name }
# => [#<Person:0x007fb5899ef4a8 @name="tanaka", @age=11>, #<Person:0x007fb5899ef728 @name="suzuki", @age=11>]
//}

@
raise TypeError ブロックが整数以外を返したときに発生します。...

絞り込み条件を変える

Thread#abort_on_exception=(newstate) (115.0)

真の場合、そのスレッドが例外によって終了した時に、インタプリタ 全体を中断させます。false の場合、あるスレッドで起こった例 外は、Thread#join などで検出されない限りそのスレッ ドだけをなにも警告を出さずに終了させます。

...c:Thread#exceptionを参照してください。

@
param newstate 自身を実行中に例外発生した場合、インタプリタ全体を終了させるかどうかを true か false で指定します。

//emlist[例][ruby]{
thread = Thread.new { sleep 1 }
thread.abort_on_exception # => false...
<< 1 2 3 ... > >>