るりまサーチ

最速Rubyリファレンスマニュアル検索!
48件ヒット [1-48件を表示] (0.127秒)
トップページ > クエリ:spec/pattern_matching[x] > 種類:インスタンスメソッド[x]

別のキーワード

  1. rexml/document new
  2. rexml/document write
  3. rexml/document clone
  4. rexml/document to_s
  5. rexml/document node_type

ライブラリ

クラス

キーワード

検索結果

CSV::Row#deconstruct -> [object] (7.0)

パターンマッチに使用する行の値の配列を返します。

...3])
case row
in [2.., 2.., 2..]
puts "all 2 or more"
in [...2, 2.., 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_primitive_objects...

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

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

.... }
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_primitive_objects...

Data#deconstruct -> [object] (7.0)

self のメンバの値を配列で返します。

......
end
//}

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

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

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

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

...ます。

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

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

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

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

...g 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...

絞り込み条件を変える

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

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

...> "working day in 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...

MatchData#captures -> [String] (7.0)

$1, $2, ... を格納した配列を返します。

...応する要素は nil になります。

//emlist[例][ruby]{
/(foo)(bar)(BAZ)?/ =~ "foobarbaz"
p $~.to_a # => ["foobar", "foo", "bar", nil]
p $~.captures # => ["foo", "bar", nil]
//}

@see MatchData#to_a, MatchData#named_captures, d:spec/pattern_matching#matching_non_primitive_objects...

MatchData#deconstruct -> [String] (7.0)

$1, $2, ... を格納した配列を返します。

...応する要素は nil になります。

//emlist[例][ruby]{
/(foo)(bar)(BAZ)?/ =~ "foobarbaz"
p $~.to_a # => ["foobar", "foo", "bar", nil]
p $~.captures # => ["foo", "bar", nil]
//}

@see MatchData#to_a, MatchData#named_captures, d:spec/pattern_matching#matching_non_primitive_objects...

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

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

...{: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...

Struct#deconstruct -> [object] (7.0)

構造体のメンバの値を配列にいれて返します。

...345]
//}

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

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

絞り込み条件を変える

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

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

...345}
//}

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

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

Struct#to_a -> [object] (7.0)

構造体のメンバの値を配列にいれて返します。

...345]
//}

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

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

Struct#values -> [object] (7.0)

構造体のメンバの値を配列にいれて返します。

...345]
//}

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

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

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

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

...ng 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...