るりまサーチ

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

別のキーワード

  1. bigdecimal/util to_d
  2. float to_d
  3. rsa d
  4. rsa d=
  5. matrix d

ライブラリ

クラス

モジュール

キーワード

検索結果

<< 1 2 3 ... > >>

GDBM#keys -> [String] (21107.0)

データベース中に存在するキー全てを含む配列を返します。

...データベース中に存在するキー全てを含む配列を返します。

require 'gdbm'

d
b1 = GDBM.open('aaa.gdbm', 0666, GDBM::NEWDB)
d
b1['a'] = 'aaa'
d
b1['b'] = 'bbb'
p db1.keys #=> ["a", "b"]...

SDBM#keys -> [String] (21107.0)

データベース中に存在するキー全てを含む配列を返します。

...データベース中に存在するキー全てを含む配列を返します。

require 'sdbm'

d
b1 = SDBM.open('aaa.gdbm', 0666)
d
b1['a'] = 'aaa'
d
b1['b'] = 'bbb'
d
b1['c'] = 'ccc'
p db1.keys #=> ["a", "b","c"]...

Thread#keys -> [Symbol] (21107.0)

スレッド固有データに関連づけられたキーの配列を返します。キーは Symbol で返されます。

...スレッド固有データに関連づけられたキーの配列を返します。キーは
Symbol で返されます。

th = Thread.current
th[:foo] = 'FOO'
th['bar'] = 'BAR'
p th.keys

#=> [:bar, :foo]...

DBM#keys -> [String] (21101.0)

データベース中に存在するキー全てを含む配列を返します。

データベース中に存在するキー全てを含む配列を返します。

CSV::Row#deconstruct_keys(keys) -> Hash (12314.0)

パターンマッチに使用するヘッダの名前と値の Hash を返します。

...@param keys パターンマッチに使用するヘッダの名前の配列を指定します。nil の場合は全てをパターンマッチに使用します。

//emlist[例][ruby]{
require "csv"

row = CSV::Row.new([:header1, :header2, :header3], [1, 2, 3])
case row
in { header1: 2.., header2:...
...2.., header3: 2.. }
puts "all 2 or more"
in { header1: ...2, header2: 2.., header3: 2.. }
puts "first column is less than 2, and rest columns are 2 or more"
end
#=> "first column is less than 2, and rest columns are 2 or more" が出力される
//}

@see d:spec/pattern_matching#matching_non_pri...

絞り込み条件を変える

MatchData#deconstruct_keys(array_of_names) -> Hash (12261.0)

引数で指定された名前の名前付きキャプチャを Hash で返します。

...す。

//emlist[例][ruby]{
m = /(?<hours>\d{2}):(?<minutes>\d{2}):(?<seconds>\d{2})/.match("18:37:22")
m.deconstruct_keys([:hours, :minutes]) # => {:hours => "18", :minutes => "37"}
m.deconstruct_keys(nil) # => {:hours => "18", :minutes => "37", :seconds => "22"}

# 名前付きキャプチャが...
...定義されていなかった場合は空のハッシュを返す
m = /(\d{2}):(\d{2}):(\d{2})/.match("18:37:22")
m.deconstruct_keys(nil) # => {}
//}

@see d:spec/pattern_matching#matching_non_primitive_objects...

Date#deconstruct_keys(array_of_names_or_nil) -> Hash (12237.0)

パターンマッチに使用する名前と値の Hash を返します。

...h
* :day
* :yday
* :wday

@param array_of_names_or_nil パターンマッチに使用する名前の配列を指定します。nil の場合は全てをパターンマッチに使用します。

//emlist[例][ruby]{
d
= Date.new(2022, 10, 5)

if d in wday: 3, day: ..7 # deconstruct_keys...
...使われます
puts "first Wednesday of the month"
end
#=> "first Wednesday of the month" が出力される

case d
in year: ...2022
puts "too old"
in month: ..9
puts "quarter 1-3"
in wday: 1..5, month:
puts "working day in month #{month}"
end
#=> "working day in month 10" が出力され...
...

# クラスのチェックと組み合わせて利用することもできます
if d in Date(wday: 3, day: ..7)
puts "first Wednesday of the month"
end
//}

@see d:spec/pattern_matching#matching_non_primitive_objects...

Data#deconstruct_keys(array_of_names_or_nil) -> Hash (12225.0)

self のメンバの名前と値の組を Hash で返します。

...と値の組を Hash で返します。

//emlist[例][ruby]{
Measure = Data.define(:amount, :unit)

d
istance = Measure.new(10, 'km')
d
istance.deconstruct_keys(nil) # => {:amount=>10, :unit=>"km"}
d
istance.deconstruct_keys([:amount]) # => {:amount=>10}
//}

このメソッドは以下のよう...
...

//emlist[例][ruby]{
Measure = Data.define(:amount, :unit)
d
istance = Measure.new(10, 'km')

case distance
in amount:, unit: 'km' # 裏側で #deconstruct_keys を呼ぶ
puts "It is #{amount} kilometers away"
else
puts "Don't know how to handle it"
end
# "It is 10 kilometers away" が表示...
...case distance
in Measure(amount:, unit: 'km')
puts "It is #{amount} kilometers away"
# ...
end
//}

@param array_of_names_or_nil 返り値に含めるメンバの名前の配列を指定します。nil の場合は全てのメンバを意味します。

[注意] 本メソッドの記述は Data...

Struct#deconstruct_keys(array_of_names) -> Hash (12219.0)

self のメンバの名前と値の組を Hash で返します。

...uct.new(:name, :address, :zip)
joe = Customer.new("Joe Smith", "123 Maple, Anytown NC", 12345)
h = joe.deconstruct_keys([:zip, :address])
h # => {:zip=>12345, :address=>"123 Maple, Anytown NC"}

# 引数が nil の場合は全てのメンバを返します。
h = joe.deconstruct_keys(nil)
h # => {:n...
...r.", :address=>"123 Maple, Anytown NC", :zip=>12345}
//}

[注意] 本メソッドの記述は Struct の下位クラスのインスタンスに対して呼び
出す事を想定しています。Struct.new は Struct の下位クラスを作成する点に
注意してください。

@see d:spec/p...

DateTime#deconstruct_keys(array_of_names_or_nil) -> Hash (12213.0)

パターンマッチに使用する名前と値の Hash を返します。

...month
* :day
* :yday
* :wday
* :hour
* :min
* :sec
* :sec_fraction
* :zone

@param array_of_names_or_nil パターンマッチに使用する名前の配列を指定します。nil の場合は全てをパターンマッチに使用します。

//emlist[例][ruby]{
d
t = DateTime.new...
...)

if dt in wday: 1..5, hour: 10..18 # deconstruct_keys が使われます
puts "Working time"
end
#=> "Working time" が出力される

case dt
in year: ...2022
puts "too old"
in month: ..9
puts "quarter 1-3"
in wday: 1..5, month:
puts "working day in month #{month}"
end
#=> "working day i...
...n month 10" が出力される

# クラスのチェックと組み合わせて利用することもできます
if dt in DateTime(wday: 1..5, hour: 10..18, day: ..7)
puts "Working time, first week of the month"
end
//}

@see d:spec/pattern_matching#matching_non_primitive_objects...

絞り込み条件を変える

Time#deconstruct_keys(array_of_names_or_nil) -> Hash (12213.0)

パターンマッチに使用する名前と値の Hash を返します。

...の Hash を返します。

キーに利用できる名前は以下の通りです。

* :year
* :month
* :day
* :yday
* :wday
* :hour
* :min
* :sec
* :subsec
* :dst
* :zone

@param array_of_names_or_nil パターンマッチに使用する名前の配列を指定します。n...
...in wday: 3, day: ..7 # deconstruct_keys が使われます
puts "first Wednesday of the month"
end
#=> "first Wednesday of the month" が出力される

case t
in year: ...2022
puts "too old"
in month: ..9
puts "quarter 1-3"
in wday: 1..5, month:
puts "working day in month #{month}"
end
#=>...
..."working day in month 10" が出力される

# クラスのチェックと組み合わせて利用することもできます
if t in Time(wday: 3, day: ..7)
puts "first Wednesday of the month"
end
//}

@see d:spec/pattern_matching#matching_non_primitive_objects...

static VALUE rb_thread_keys(VALUE thread) (12200.0)

static int thread_keys_i(ID key, VALUE value, VALUE ary) (12200.0)

Etc::SC_THREAD_KEYS_MAX -> Integer (6201.0)

Etc.#sysconf の引数に指定します。

Etc.#sysconf の引数に指定します。

詳細は sysconf(3) を参照してください。
<< 1 2 3 ... > >>