るりまサーチ

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

別のキーワード

  1. openssl p
  2. openssl p=
  3. fileutils mkdir_p
  4. dsa p
  5. rsa p

クラス

キーワード

検索結果

<< 1 2 > >>

String#ord -> Integer (18115.0)

文字列の最初の文字の文字コードを整数で返します。

...の文字コードを整数で返します。

self が空文字列のときは例外を発生します。

@return 文字コードを表す整数
@raise ArgumentError self の長さが 0 のとき発生

//emlist[例][ruby]{
p
"a".ord # => 97
//}

@see Integer#chr, String#chr...

Proc#ruby2_keywords -> proc (9202.0)

Marks the proc as passing keywords through a normal argument splat. This should only be called on procs that accept an argument splat (`*args`) but not explicit keywords or a keyword splat. It marks the proc such that if the proc is called with keyword arguments, the final hash argument is marked with a special flag such that if it is the final element of a normal argument splat to another method call, and that method call does not include explicit keywords or a keyword splat, the final element is interpreted as keywords. In other words, keywords will be passed through the proc to other methods.

...e proc as passing keywords through a normal argument splat. This
should only be called on procs that accept an argument splat (`*args`)
but not explicit keywords or a keyword splat. It marks the proc such
that if the proc is called with keyword arguments, the final hash
argument is marked with a sp...
...gument splat to another method call, and that
method call does not include explicit keywords or a keyword splat, the
final element is interpreted as keywords. In other words, keywords will
be passed through the proc to other methods.

This should only be used for procs that delegate keywords to ano...
...ther
method, and only for backwards compatibility with Ruby versions before
2.7.

This method will probably be removed at some point, as it exists only
for backwards compatibility. As it does not exist in Ruby versions
before 2.7, check that the proc responds to this method before calling
it. Also,...

Encoding::Converter#primitive_convert(source_buffer, destination_buffer) -> Symbol (6114.0)

エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。

...Encoding::Converter#primitive_convert が唯一の方法になります。

@param source_buffer 変換元文字列のバッファ
@param destination_buffer 変換先文字列を格納するバッファ
@param destination_byteoffset 変換先バッファでのオフセット
@param destination_bytes...
...容量
@param options 変換の詳細を指定する定数やハッシュ
@return 変換結果を表す Symbol

options には以下が指定できます。

: hash form
:partial_input => true # source buffer may be part of larger source
:after_output => true # stop conversi...
...put before input
: integer form
Encoding::Converter::PARTIAL_INPUT
Encoding::Converter::AFTER_OUTPUT

戻り値は以下のうちのどれかです。

* :invalid_byte_sequence
* :incomplete_input
* :undefined_conversion
* :after_output
* :destination_buffer_full
* :source_buffer_emp...

Encoding::Converter#primitive_convert(source_buffer, destination_buffer, destination_byteoffset) -> Symbol (6114.0)

エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。

...Encoding::Converter#primitive_convert が唯一の方法になります。

@param source_buffer 変換元文字列のバッファ
@param destination_buffer 変換先文字列を格納するバッファ
@param destination_byteoffset 変換先バッファでのオフセット
@param destination_bytes...
...容量
@param options 変換の詳細を指定する定数やハッシュ
@return 変換結果を表す Symbol

options には以下が指定できます。

: hash form
:partial_input => true # source buffer may be part of larger source
:after_output => true # stop conversi...
...put before input
: integer form
Encoding::Converter::PARTIAL_INPUT
Encoding::Converter::AFTER_OUTPUT

戻り値は以下のうちのどれかです。

* :invalid_byte_sequence
* :incomplete_input
* :undefined_conversion
* :after_output
* :destination_buffer_full
* :source_buffer_emp...

Encoding::Converter#primitive_convert(source_buffer, destination_buffer, destination_byteoffset, destination_bytesize) -> Symbol (6114.0)

エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。

...Encoding::Converter#primitive_convert が唯一の方法になります。

@param source_buffer 変換元文字列のバッファ
@param destination_buffer 変換先文字列を格納するバッファ
@param destination_byteoffset 変換先バッファでのオフセット
@param destination_bytes...
...容量
@param options 変換の詳細を指定する定数やハッシュ
@return 変換結果を表す Symbol

options には以下が指定できます。

: hash form
:partial_input => true # source buffer may be part of larger source
:after_output => true # stop conversi...
...put before input
: integer form
Encoding::Converter::PARTIAL_INPUT
Encoding::Converter::AFTER_OUTPUT

戻り値は以下のうちのどれかです。

* :invalid_byte_sequence
* :incomplete_input
* :undefined_conversion
* :after_output
* :destination_buffer_full
* :source_buffer_emp...

絞り込み条件を変える

Encoding::Converter#primitive_convert(source_buffer, destination_buffer, destination_byteoffset, destination_bytesize, options) -> Symbol (6114.0)

エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。

...Encoding::Converter#primitive_convert が唯一の方法になります。

@param source_buffer 変換元文字列のバッファ
@param destination_buffer 変換先文字列を格納するバッファ
@param destination_byteoffset 変換先バッファでのオフセット
@param destination_bytes...
...容量
@param options 変換の詳細を指定する定数やハッシュ
@return 変換結果を表す Symbol

options には以下が指定できます。

: hash form
:partial_input => true # source buffer may be part of larger source
:after_output => true # stop conversi...
...put before input
: integer form
Encoding::Converter::PARTIAL_INPUT
Encoding::Converter::AFTER_OUTPUT

戻り値は以下のうちのどれかです。

* :invalid_byte_sequence
* :incomplete_input
* :undefined_conversion
* :after_output
* :destination_buffer_full
* :source_buffer_emp...

Exception#full_message(highlight: true, order: :bottom) -> String (3120.0)

例外の整形された文字列を返します。

...数 highlight と order は 2.5.1 で追加されました。

@param highlight エスケープシーケンスによる文字装飾をつけるかどうかを指定します。
デフォルト値は Exception.to_tty? の返り値と同じです。

@param order :top か :bottom で...
...の一番奥がエラーメッセージの上(top)か下(bottom)かを指定します。
デフォルト値は Exception.to_tty? が真なら :bottom で偽なら :top です。

//emlist[例][ruby]{
begin
raise "test"
rescue => e
p
e.full_message # => "\e[1mTraceback \e[m(most re...
...e[1m)\n\e[m"
$stderr = $stdout
p
e.full_message # => "test.rb:2:in `<main>': test (RuntimeError)\n"
$stderr = STDERR
p
e.full_message # => "\e[1mTraceback \e[m(most recent call last):\ntest.rb:2:in `<main>': \e[1mtest (\e[4;1mRuntimeError\e[m\e[1m)\n\e[m"
end
//}

@see Exception.to_tty?...
...文字装飾がついています。


@param highlight エスケープシーケンスによる文字装飾をつけるかどうかを指定します。
デフォルト値は Exception.to_tty? の返り値と同じです。

@param order :top か :bottom で指定する必要があ...

Struct.new(*args, keyword_init: false) -> Class (121.0)

Struct クラスに新しいサブクラスを作って、それを返します。

...クセスメソッドが定義されています。

//emlist[例][ruby]{
dog = Struct.new("Dog", :name, :age)
fred = dog.new("fred", 5)
fred.age = 6
p
rintf "name:%s age:%d", fred.name, fred.age
#=> "name:fred age:6" を出力します
//}

実装の都合により、クラス名の省略は後づ...
...@param args 構造体を定義するための可変長引数。String または Symbol を指定します。
@param keyword_init true を指定すると、キーワード引数で初期化する構造体を定義します。

//emlist[例][ruby]{
P
oint = Struct.new(:x, :y, keyword_init: true) # => P...
...oint(keyword_init: true)
P
oint.new(x: 1, y: 2) # => #<struct Point x=1, y=2>
P
oint.new(x: 1) # => #<struct Point x=1, y=nil>
P
oint.new(y: 2) # => #<struct Point x=nil, y=2>
P
oint.new(z: 3) # ArgumentError (unknown keywords: z)
//}


=== 第一引数が String の場合
args[0] が...

Struct.new(*args, keyword_init: false) {|subclass| block } -> Class (121.0)

Struct クラスに新しいサブクラスを作って、それを返します。

...クセスメソッドが定義されています。

//emlist[例][ruby]{
dog = Struct.new("Dog", :name, :age)
fred = dog.new("fred", 5)
fred.age = 6
p
rintf "name:%s age:%d", fred.name, fred.age
#=> "name:fred age:6" を出力します
//}

実装の都合により、クラス名の省略は後づ...
...@param args 構造体を定義するための可変長引数。String または Symbol を指定します。
@param keyword_init true を指定すると、キーワード引数で初期化する構造体を定義します。

//emlist[例][ruby]{
P
oint = Struct.new(:x, :y, keyword_init: true) # => P...
...oint(keyword_init: true)
P
oint.new(x: 1, y: 2) # => #<struct Point x=1, y=2>
P
oint.new(x: 1) # => #<struct Point x=1, y=nil>
P
oint.new(y: 2) # => #<struct Point x=nil, y=2>
P
oint.new(z: 3) # ArgumentError (unknown keywords: z)
//}


=== 第一引数が String の場合
args[0] が...

Struct.new(*args, keyword_init: nil) -> Class (121.0)

Struct クラスに新しいサブクラスを作って、それを返します。

...クセスメソッドが定義されています。

//emlist[例][ruby]{
dog = Struct.new("Dog", :name, :age)
fred = dog.new("fred", 5)
fred.age = 6
p
rintf "name:%s age:%d", fred.name, fred.age
#=> "name:fred age:6" を出力します
//}

実装の都合により、クラス名の省略は後づ...
...う。
したがって、メンバ名は Symbol で指定するのが無難です。

@param args 構造体を定義するための可変長引数。String または Symbol を指定します。
@param keyword_init true を指定すると、キーワード引数で初期化する構造体を定義...
...by]{
P
oint = Struct.new(:x, :y, keyword_init: true) # => Point(keyword_init: true)
P
oint.new(x: 1, y: 2) # => #<struct Point x=1, y=2>
P
oint.new(x: 1) # => #<struct Point x=1, y=nil>
P
oint.new(y: 2) # => #<struct Point x=nil, y=2>
P
oint.new(z: 3) # ArgumentError (unknown keywords:...
...う。
したがって、メンバ名は Symbol で指定するのが無難です。

@param args 構造体を定義するための可変長引数。String または Symbol を指定します。
@param keyword_init 構造体クラスのインスタンスを生成する際に、キーワード引数...
...t[例][ruby]{
P
oint1 = Struct.new(:x, :y)
P
oint1.new(1, 2) # => #<struct Point1 x=1, y=2>
P
oint1.new(x: 1, y: 2) # => #<struct Point1 x=1, y=2>
P
oint1.new(x: 1) # => #<struct Point1 x=1, y=nil>
P
oint1.new(y: 2) # => #<struct Point1 x=nil, y=2>
P
oint1.new(x:...

絞り込み条件を変える

Struct.new(*args, keyword_init: nil) {|subclass| block } -> Class (121.0)

Struct クラスに新しいサブクラスを作って、それを返します。

...クセスメソッドが定義されています。

//emlist[例][ruby]{
dog = Struct.new("Dog", :name, :age)
fred = dog.new("fred", 5)
fred.age = 6
p
rintf "name:%s age:%d", fred.name, fred.age
#=> "name:fred age:6" を出力します
//}

実装の都合により、クラス名の省略は後づ...
...う。
したがって、メンバ名は Symbol で指定するのが無難です。

@param args 構造体を定義するための可変長引数。String または Symbol を指定します。
@param keyword_init true を指定すると、キーワード引数で初期化する構造体を定義...
...by]{
P
oint = Struct.new(:x, :y, keyword_init: true) # => Point(keyword_init: true)
P
oint.new(x: 1, y: 2) # => #<struct Point x=1, y=2>
P
oint.new(x: 1) # => #<struct Point x=1, y=nil>
P
oint.new(y: 2) # => #<struct Point x=nil, y=2>
P
oint.new(z: 3) # ArgumentError (unknown keywords:...
...う。
したがって、メンバ名は Symbol で指定するのが無難です。

@param args 構造体を定義するための可変長引数。String または Symbol を指定します。
@param keyword_init 構造体クラスのインスタンスを生成する際に、キーワード引数...
...t[例][ruby]{
P
oint1 = Struct.new(:x, :y)
P
oint1.new(1, 2) # => #<struct Point1 x=1, y=2>
P
oint1.new(x: 1, y: 2) # => #<struct Point1 x=1, y=2>
P
oint1.new(x: 1) # => #<struct Point1 x=1, y=nil>
P
oint1.new(y: 2) # => #<struct Point1 x=nil, y=2>
P
oint1.new(x:...

Integer#chr -> String (44.0)

self を文字コードとして見た時に、引数で与えたエンコーディング encoding に対応する文字を返します。

...する文字を返します。

//emlist[][ruby]{
p
65.chr
# => "A"
p
12354.chr
# => `chr': 12354 out of char range (RangeError)

p
12354.chr(Encoding::UTF_8)
# => "あ"
p
12354.chr(Encoding::EUC_JP)
# => RangeError: invalid codepoint 0x3042 in EUC-JP
//}

引数無しで呼ばれた場合は self...
...ォルト内部エンコーディングの順で優先的に解釈します。

//emlist[][ruby]{
p
0x79.chr.encoding # => #<Encoding:US_ASCII>
p
0x80.chr.encoding # => #<Encoding:ASCII_8BIT>
//}

@param encoding エンコーディングを表すオブジェクト。Encoding::UTF_8、'shift_jis' な...
...ど。
@return 一文字からなる文字列
@raise RangeError self を与えられたエンコーディングで正しく解釈できない場合に発生します。
@see String#ord Encoding.default_internal...

Integer#chr(encoding) -> String (44.0)

self を文字コードとして見た時に、引数で与えたエンコーディング encoding に対応する文字を返します。

...する文字を返します。

//emlist[][ruby]{
p
65.chr
# => "A"
p
12354.chr
# => `chr': 12354 out of char range (RangeError)

p
12354.chr(Encoding::UTF_8)
# => "あ"
p
12354.chr(Encoding::EUC_JP)
# => RangeError: invalid codepoint 0x3042 in EUC-JP
//}

引数無しで呼ばれた場合は self...
...ォルト内部エンコーディングの順で優先的に解釈します。

//emlist[][ruby]{
p
0x79.chr.encoding # => #<Encoding:US_ASCII>
p
0x80.chr.encoding # => #<Encoding:ASCII_8BIT>
//}

@param encoding エンコーディングを表すオブジェクト。Encoding::UTF_8、'shift_jis' な...
...ど。
@return 一文字からなる文字列
@raise RangeError self を与えられたエンコーディングで正しく解釈できない場合に発生します。
@see String#ord Encoding.default_internal...
<< 1 2 > >>