別のキーワード
ライブラリ
クラス
- Array (31)
- BasicObject (24)
-
CSV
:: Row (3) - Data (3)
- Date (2)
- DateTime (2)
- Hash (785)
-
JSON
:: Parser (24) -
JSON
:: State (48) - KeyError (28)
- MatchData (2)
- Method (12)
- Module (12)
-
ObjectSpace
:: WeakMap (12) - Proc (18)
-
REXML
:: Element (48) -
Rake
:: TaskArguments (24) - Struct (36)
- Thread (24)
- Time (2)
モジュール
- Enumerable (31)
- GC (48)
- Kernel (20)
-
Net
:: HTTPHeader (168) - TSort (163)
オブジェクト
- ENV (215)
キーワード
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (12) - Cipher (12)
- Hash (12)
- KeyError (12)
-
NEWS for Ruby 2
. 0 . 0 (12) -
NEWS for Ruby 2
. 5 . 0 (8) -
NEWS for Ruby 2
. 6 . 0 (7) -
NEWS for Ruby 2
. 7 . 0 (6) - Rubyで使われる記号の意味(正規表現の複雑な記号は除く) (12)
- Ruby用語集 (12)
- Symbol (12)
- [] (72)
- []= (48)
-
add
_ attribute (24) -
add
_ field (12) - assoc (24)
- cgi (12)
- chunk (12)
- configure (12)
-
deconstruct
_ keys (20) - default (24)
-
default
_ proc (12) -
default
_ proc= (12) - delete (60)
-
delete
_ attribute (12) -
delete
_ if (48) - dig (20)
-
drb
/ ssl (12) - each (60)
-
each
_ capitalized _ name (12) -
each
_ element _ with _ attribute (12) -
each
_ header (12) -
each
_ key (60) -
each
_ name (12) -
each
_ pair (48) -
each
_ strongly _ connected _ component (46) -
each
_ strongly _ connected _ component _ from (23) -
each
_ value (24) - except (8)
- fetch (72)
-
fetch
_ values (20) - filter (14)
- filter! (14)
-
get
_ fields (12) -
has
_ key? (12) -
has
_ value? (12) - httpd (8)
- include? (12)
- indent (12)
- indent= (12)
- index (7)
-
instance
_ eval (24) - invert (12)
-
keep
_ if (24) - key? (36)
- keys (12)
-
keyword
_ init? (4) -
latest
_ gc _ info (24) - member? (12)
- merge (36)
- merge! (24)
- new (80)
- openssl (12)
- parameters (24)
- parse (12)
-
rdoc
/ parser / c (12) - reject (48)
- reject! (48)
-
ruby 1
. 6 feature (12) -
ruby 1
. 8 . 2 feature (12) -
ruby 1
. 8 . 4 feature (12) -
ruby 1
. 9 feature (12) -
ruby2
_ keywords (18) -
ruby2
_ keywords _ hash? (6) -
rubygems
/ commands / cert _ command (12) -
rubygems
/ security (12) - select (24)
- select! (24)
- shift (12)
- slice (15)
-
st
_ delete _ safe (12) - stat (24)
- store (24)
-
strongly
_ connected _ components (24) -
thread
_ variable _ set (12) -
to
_ h (52) -
transform
_ keys (20) -
transform
_ keys! (20) - tsort (36)
-
tsort
_ each (46) - update (24)
- value? (12)
-
values
_ at (12) -
with
_ defaults (12) - クラス/メソッドの定義 (12)
- パターンマッチ (12)
検索結果
先頭5件
-
Hash
# key(val) -> object (18125.0) -
値 val に対応するキーを返します。対応する要素が存在しない時には nil を返します。
...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......キーが複数存在する場合、どのキーを返すかは不定です。
@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... -
Hash
. ruby2 _ keywords _ hash?(hash) -> bool (12291.0) -
Module#ruby2_keywordsやProc#ruby2_keywordsによる ruby2_keywords フラグが設定されているかどうかを返します。
...Module#ruby2_keywordsやProc#ruby2_keywordsによる
ruby2_keywords フラグが設定されているかどうかを返します。
このメソッドはデバッグや調査、シリアライゼーションのために本当に必要な場合のために
用意されていて、普通のプログ......れていません。
ruby 2.7.1 で追加されたため、ruby 2.7.0 では定義されていません。
//emlist[][ruby]{
ruby2_keywords def foo(*args)
Hash.ruby2_keywords_hash?(args.last)
end
foo(k: 1) # => true
foo({k: 1}) # => false
//}
@see Module#ruby2_keywords, Proc#ruby2_keywords... -
Module
# ruby2 _ keywords(method _ name , . . . ) -> nil (12231.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.
...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 arg......de 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.
This should only be used for methods that delegate keywords to another
method, and only for backwards compatibility with Ruby versions......ility. As it does not exist in Ruby versions
before 2.7, check that the module responds to this method before calling
it. Also, be aware that if this method is removed, the behavior of the
method will change so that it does not pass through keywords.
//emlist[例][ruby]{
module Mod
def foo(meth,... -
Proc
# ruby2 _ keywords -> proc (12231.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.
...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......ude 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 another
method, and only for backwards compatibility with Ruby versions be......atibility. As it does not exist in Ruby versions
before 2.7, check that the proc responds to this method before calling
it. Also, be aware that if this method is removed, the behavior of the
proc will change so that it does not pass through keywords.
//emlist[][ruby]{
module Mod
foo = ->(meth, *a... -
ENV
. each _ key {|key| . . . } -> self (6261.0) -
key を引数としてブロックを評価します。
...key を引数としてブロックを評価します。
//emlist[][ruby]{
ENV['FOO'] = 'bar'
ENV.each_key do |key|
p "key #{key} detected" if key == 'FOO'
end
# "key FOO detected"
//}... -
Net
:: HTTPHeader # key?(key) -> bool (6258.0) -
key というヘッダフィールドがあれば真を返します。 key は大文字小文字を区別しません。
...key というヘッダフィールドがあれば真を返します。
key は大文字小文字を区別しません。
@param key 探すヘッダフィールド名を文字列で与えます。
//emlist[例][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.com/index.html')
res = Ne......t::HTTP.get_response(uri)
res.key?('content-type') # => true
res.key?('nonexist-header') # => false
//}... -
Hash
# has _ key?(key) -> bool (6246.0) -
ハッシュが key をキーとして持つ時真を返します。
...ハッシュが key をキーとして持つ時真を返します。
@param key 探索するキーを指定します。
//emlist[][ruby]{
p({1 => "one"}.key?(1)) # => true
p({1 => "one"}.key?(2)) # => false
//}
@see Hash#value?... -
Hash
# key?(key) -> bool (6246.0) -
ハッシュが key をキーとして持つ時真を返します。
...ハッシュが key をキーとして持つ時真を返します。
@param key 探索するキーを指定します。
//emlist[][ruby]{
p({1 => "one"}.key?(1)) # => true
p({1 => "one"}.key?(2)) # => false
//}
@see Hash#value?... -
Hash
# each _ key {|key| . . . } -> self (6227.0) -
ハッシュのキーを引数としてブロックを評価します。
...れた順です。
ブロック付きの場合selfを、
無しで呼ばれた場合Enumeratorを返します。
//emlist[例][ruby]{
{:a=>1, :b=>2}.each_key {|k| p k}
#=> :a
# :b
p({:a=>1, :b=>2}.each_key) # => #<Enumerator: {:a=>1, :b=>2}:each_key>
//}
@see Hash#each_pair,Hash#each_value... -
Hash
# transform _ keys {|key| . . . } -> Hash (6207.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}" }...