るりまサーチ

最速Rubyリファレンスマニュアル検索!
1052件ヒット [1-100件を表示] (0.260秒)
トップページ > クエリ:I[x] > クエリ:RUBY[x] > クエリ:E[x] > クエリ:key[x]

別のキーワード

  1. rbconfig ruby
  2. fiddle ruby_free
  3. fiddle build_ruby_platform
  4. rake ruby
  5. rubygems/defaults ruby_engine

ライブラリ

クラス

モジュール

オブジェクト

検索結果

<< 1 2 3 ... > >>

Hash#key(val) -> object (24225.0)

値 val に対応するキーを返します。対応する要素が存在しない時には nil を返します。

...には
nil を返します。

該当するキーが複数存在する場合、どのキーを返すかは不定です。

Hash#index は obsolete です。
使用すると警告メッセージが表示されます。

@param val 探索に用いる値を指定します。

//emlist[例][ruby]{
h = {...
...:ab => "some" , :cd => "all" , :ef => "all"}

p h.key("some") #=> :ab
p h.key("all") #=> :cd
p h.key("at") #=> nil
//}

@see Hash#invert...

Module#ruby2_keywords(method_name, ...) -> nil (18431.0)

For the given method names, marks the method as passing keywords through a normal argument splat. This should only be called on methods that accept an argument splat (`*args`) but not explicit keywords or a keyword splat. It marks the method such that if the method 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 method to other methods.

...he given method names, marks the method as passing keywords through
a normal argument splat. This should only be called on methods that
accept an argument splat (`*args`) but not explicit keywords or a
key
word splat. It marks the method such that if the method 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
key
words or a keyword splat, the final element is interpreted as
key
words. In other words, keywords will be passed...
...the method to
other methods.

This should only be used for methods that delegate keywords to another
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...

Struct.keyword_init? -> bool | nil (18306.0)

(このメソッドは Struct の下位クラスにのみ定義されています) 構造体が作成されたときに keyword_init: true を指定されていたら true を返します。 false を指定されていたら false を返します。 それ以外の場合は nil を返します。

... keyword_init: true を指定されていたら true を返します。
false を指定されていたら false を返します。
それ以外の場合は nil を返します。

//emlist[例][ruby]{
Foo = Struct.new(:a)
Foo.keyword_init? # => nil
Bar = Struct.new(:a, keyword_init: true)
Bar.keywor...
...d_init? # => true
Baz = Struct.new(:a, keyword_init: false)
Baz.keyword_init? # => false
//}...

rubygems/security (18174.0)

このライブラリは暗号署名を RubyGems パッケージに使用するために使用します。

...このライブラリは暗号署名を RubyGems パッケージに使用するために使用します。

=== 署名付きの Gem パッケージ

==== 目次

* 概要
* 解説
* コマンドラインオプション
* OpenSSL リファレンス
* Bugs / TODO
* 作者について

==== 概...
...Gem に署名するためには、秘密鍵と自己署名した証明書が必要です。
以下のコマンドを実行するとそれらを作成することができます。

# gemmaster@example.com のための秘密鍵と証明書を作成します
$ gem cert --build gemmaster@example.c...
...れが完了すると、カレントディレクトリに "gem-private_key.pem", "gem-public_cert.pem"
の二つのファイルができます。

まずは、なるべくあなただけがアクセスできる場所に "gem-private_key.pem" を移動させて
ください。 FD, CD-ROM など同じ...

Net::HTTPHeader#get_fields(key) -> [String] (15335.0)

key ヘッダフィールドの値 (文字列) を配列で返します。

...key ヘッダフィールドの値 (文字列) を配列で返します。

たとえばキー 'content-length' に対しては ['2048'] のような
文字列が得られます。一種類のヘッダフィールドが一つのヘッダの中
に複数存在することがありえます。
key
...
...ram key ヘッダフィール名を文字列で与えます。

//emlist[例][ruby]{
require 'net/http'

uri = URI.parse('http://www.example.com/index.html')
res = Net::HTTP.get_response(uri)
res.get_fields('accept-ranges') # => ["none"]
//}

@see Net::HTTPHeader#[] , Net::HTTPHeader#[]=,
Net::...
...HTTPHeader#add_field...

絞り込み条件を変える

Thread#thread_variable_set(key, value) (15323.0)

引数 key で指定した名前のスレッドローカル変数に引数 value をセットしま す。

...引数 key で指定した名前のスレッドローカル変数に引数 value をセットしま
す。

[注意]: Thread#[] でセットしたローカル変数(Fiber ローカル変数)と
異なり、セットした変数は Fiber を切り替えても共通で使える事に注意してく...
...

//emlist[例][ruby]{
thr = Thread.new do
Thread.current.thread_variable_set(:cat, 'meow')
Thread.current.thread_variable_set("dog", 'woof')
e
nd
thr.join # => #<Thread:0x401b3f10 dead>
thr.thread_variables # => [:dog, :cat]
//}

@see Thread#thread_variable_get, Thread#[]...

REXML::Element#delete_attribute(key) -> REXML::Attribute | nil (12501.0)

要素から key という属性名の属性を削除します。

... key という属性名の属性を削除します。

削除された属性を返します。

key
という属性名の属性が存在しない場合は削除されずに、nil を返します。

@param key 削除する要素(文字列(属性名) or REXML::Attributeオブジェクト)

//emlist[]...
...[ruby]{
require 'rexml/document'
e
= REXML::Element.new("E")
e
.add_attribute("x", "foo"); e # => <E x='foo'/>
e
.add_attribute("y:x", "bar"); e # => <E x='foo' y:x='bar'/>
e
.delete_attribute("x"); e # => <E y:x='bar'/>
//}...

Hash#delete_if {|key, value| ... } -> self (12480.0)

キーと値を引数としてブロックを評価した結果が真であ るような要素を self から削除します。

...素を self から削除します。

delete_if は常に self を返します。
reject! は、要素を削除しなかった場合には nil を返し、
そうでなければ self を返します。

ブロックを省略した場合は Enumerator を返します。

//emlist[例][ruby]{
h = { 2...
...reject!{|key, value| key.to_i < value.to_i } #=> { 6 => "4", 8 => "2" }
p h #=> { 6 => "4", 8 => "2" }

p h.delete_if{|key, value| key.to_i < value.to_i } #=> { 6 => "4", 8 => "2" }
p h.reject!{|key, value| key.to_i < value.to_i } #=> nil
//}

@see...
...Hash#reject,Hash#delete
@see Hash#keep_if,Hash#select!...

Hash#filter! {|key, value| ... } -> self | nil (12439.0)

キーと値を引数としてブロックを評価した結果が真であるような要素を self に残します。

...self
に残します。

keep_if は常に self を返します。
filter! と select! はオブジェクトが変更された場合に self を、
されていない場合に nil を返します。

ブロックが与えられなかった場合は、自身と keep_if から生成した
E
numerator...
...//emlist[例][ruby]{
h1 = {}
c = ("a".."g")
c.each_with_index {|e, i| h1[i] = e }

h2 = h1.dup
h1.select! # => #<Enumerator: {0=>"a", 1=>"b", 2=>"c", 3=>"d", 4=>"e", 5=>"f", 6=>"g"}:select!>

h1.select! { |k, v| k % 3 == 0 } # => {0=>"a", 3=>"d", 6=>"g"}
h1.select! { |k, v| true } # => nil...
...h2.keep_if { |k, v| k % 3 == 0 } # => {0=>"a", 3=>"d", 6=>"g"}
h2.keep_if { |k, v| true } # => {0=>"a", 3=>"d", 6=>"g"}
//}

@see Hash#select, Hash#delete_if, Hash#reject!...

Hash#transform_keys {|key| ... } -> Hash (12419.0)

すべてのキーに対してブロックを呼び出した結果で置き換えたハッシュを返します。 値は変化しません。

.../emlist[例][ruby]{
h = { a: 1, b: 2, c: 3 }
h.transform_keys {|k| k.to_s } # => {"a"=>1, "b"=>2, "c"=>3}
h.transform_keys(&:to_s) # => {"a"=>1, "b"=>2, "c"=>3}
h.transform_keys.with_index {|k, i| "#{k}.#{i}" }
# => {"a.0"=>1, "b.1"=>2, "c.2"=>3}
//}

@see...
...Hash#transform_keys!
@see Hash#transform_values
@see Hash#transform_values!...
...す。

//emlist[例][ruby]{
h = { a: 1, b: 2, c: 3 }
h.transform_keys {|k| k.to_s } # => {"a"=>1, "b"=>2, "c"=>3}
h.transform_keys(a: "a", d: "d") # => {"a"=>1, :b=>2, :c=>3}
h.transform_keys(&:to_s) # => {"a"=>1, "b"=>2, "c"=>3}
h.transform_keys.with_index {|k, i| "#{k}.#{i}" }...
...# => {"a.0"=>1, "b.1"=>2, "c.2"=>3}
//}

@see Hash#transform_keys!
@see Hash#transform_values
@see Hash#transform_values!...

絞り込み条件を変える

Hash#transform_keys! {|key| ... } -> self (12419.0)

すべてのキーに対してブロックを呼び出した結果でハッシュのキーを変更します。 値は変化しません。

...return transform_keys! は常に self を返します。
ブロックが与えられなかった場合は、Enumerator オブジェクトを
返します。


//emlist[例][ruby]{
h = { a: 1, b: 2, c: 3 }
h.transform_keys! {|k| k.to_s } # => {"a"=>1, "b"=>2, "c"=>3}
h.transform_key...
...s!(&:to_sym) # => {:a=>1, :b=>2, :c=>3}
h.transform_keys!.with_index {|k, i| "#{k}.#{i}" }
# => {"a.0"=>1, "b.1"=>2, "c.2"=>3}
//}

@see Hash#transform_keys
@see Hash#transform_values
@see Hash#transform_values!...
...# => {:a=>1, :b=>2, :c=>3}
h.transform_keys!(a: "a", d: "d") # => {"a"=>1, :b=>2, :c=>3}
h.transform_keys!.with_index {|k, i| "#{k}.#{i}" }
# => {"a.0"=>1, "b.1"=>2, "c.2"=>3}
//}

@see Hash#transform_keys
@see Hash#transform_values
@see Hash#transform_values!...

REXML::Element#each_element_with_attribute(key, value = nil, max = 0, name = nil) {|element| ... } -> () (12379.0)

特定の属性を持つすべての子要素を引数としてブロックを呼び出します。

...の子要素を引数としてブロックを呼び出します。

key
で指定した属性名の属性を持つ要素のみを対象とします。
value を指定すると、keyで指定した属性名を持つ属性の値がvalueである
もののみを対象とします。
maxを指定する...
...am key 属性名(文字列)
@param value 属性値(文字列)
@param max ブロック呼出の対象とする子要素の最大個数
@param name xpath文字列

//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new("<a><b id='1'/><c id='2'/><d id='1'/><e/></a>")
doc.root.each_element...
..._with_attribute('id'){|e| p e }
# >> <b id='1'/>
# >> <c id='2'/>
# >> <d id='1'/>
doc.root.each_element_with_attribute('id', '1'){|e| p e }
# >> <b id='1'/>
# >> <d id='1'/>
doc.root.each_element_with_attribute('id', '1', 1){|e| p e }
# >> <b id='1'/>
doc.root.each_element_with_attribute('id', '1',...
<< 1 2 3 ... > >>