るりまサーチ

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

別のキーワード

  1. _builtin slice
  2. _builtin slice!
  3. string slice
  4. string slice!
  5. symbol slice

ライブラリ

クラス

オブジェクト

検索結果

ENV.slice(*keys) -> Hash (18137.0)

引数で指定されたキーとその値だけを含む Hash を返します。

...を含む Hash を返します。

//emlist[例][ruby]{
ENV["foo"] = "bar"
ENV["baz"] = "qux"
ENV["bar"] = "rab"
ENV.slice() # => {}
ENV.slice("") # => {}
ENV.slice("unknown") # => {}
ENV.slice("foo", "baz") # => {"foo"=>"bar", "baz"=>"qux"}
//}

@see Hash#slice, ENV.except...

Hash#slice(*keys) -> Hash (18131.0)

引数で指定されたキーとその値だけを含む Hash を返します。

...引数で指定されたキーとその値だけを含む Hash を返します。

//emlist[例][ruby]{
h = { a: 100, b: 200, c: 300 }
h.slice(:a) # => {:a=>100}
h.slice(:c, :b) # => {:c=>300, :b=>200}
h.slice(:b, :c, :d) # => {:b=>200, :c=>300}
//}

@see Hash#except, ENV.slice...

ENV.except(*keys) -> Hash (18119.0)

引数で指定された以外のキーとその値だけを含む Hash を返します。

...引数で指定された以外のキーとその値だけを含む Hash を返します。

//emlist[][ruby]{
ENV #=> {"LANG"=>"en_US.UTF-8", "TERM"=>"xterm-256color", "HOME"=>"/Users/rhc"}
ENV.except("TERM","HOME") #=> {"LANG"=>"en_US.UTF-8"}
//}

@see Hash#except, ENV.slice...

Hash#except(*keys) -> Hash (18119.0)

引数で指定された以外のキーとその値だけを含む Hash を返します。

...引数で指定された以外のキーとその値だけを含む Hash を返します。

引数に指定されていて Hash に存在しないキーは無視されます。

//emlist[][ruby]{
h = { a: 100, b: 200, c: 300 }
h.except(:a) # => {:b=>200, :c=>300}
//}

@see Hash#slice, ENV.except...

NEWS for Ruby 3.0.0 (36.0)

NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...87
* Array#drop
* Array#drop_while
* Array#flatten
* Array#slice!
* Array#slice / Array#[]
* Array#take
* Array#take_while
* Array#uniq
* Array#*
* Can be sliced with Enumerator::ArithmeticSequence

//emlist[][ruby]{
dirty_data = ['--', 'data...
...g context. 16786
* Dir
* Dir.glob and Dir.[] now sort the results by default, and accept the `sort:` keyword option. 8709
* ENV
* ENV.except has been added, which returns a hash excluding the given keys and their values. 15822
* Windows: Read ENV names and values as UTF-8 encoded S...
...ase test first! 17176
* Hash
* Hash#transform_keys and Hash#transform_keys! now accept a hash that maps keys to new keys. 16274
* Hash#except has been added, which returns a hash excluding the given keys and their values. 15822
* IO
* IO#nonblock? now defaults to `true`. 16786...

絞り込み条件を変える