るりまサーチ

最速Rubyリファレンスマニュアル検索!
213件ヒット [1-100件を表示] (0.094秒)

別のキーワード

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

ライブラリ

クラス

モジュール

キーワード

検索結果

<< 1 2 3 > >>

Array#slice(pos, len) -> Array | nil (21239.0)

指定された自身の部分配列を返します。Array#[] と同じです。

...返します。Array#[] と同じです。

@param pos Array#[] と同じです。

@param len Array#[] と同じです。

@param range Array#[] と同じです。

//emlist[例][ruby]{
p [0, 1, 2].slice(0, 2) #=> [0, 1]
p [0, 1, 2].slice(2..3) #=> [2]
p [0, 1, 2].slice(10, 1) #=> nil
/...

Array#slice(range) -> Array | nil (21239.0)

指定された自身の部分配列を返します。Array#[] と同じです。

...返します。Array#[] と同じです。

@param pos Array#[] と同じです。

@param len Array#[] と同じです。

@param range Array#[] と同じです。

//emlist[例][ruby]{
p [0, 1, 2].slice(0, 2) #=> [0, 1]
p [0, 1, 2].slice(2..3) #=> [2]
p [0, 1, 2].slice(10, 1) #=> nil
/...

Array#slice(nth) -> object | nil (21139.0)

指定された自身の要素を返します。Array#[] と同じです。

...指定された自身の要素を返します。Array#[] と同じです。

@param nth 要素のインデックスを整数で指定します。Array#[] と同じです。

//emlist[例][ruby]{
p [0, 1, 2].slice(1) #=> 1
p [0, 1, 2].slice(2) #=> 2
p [0, 1, 2].slice(10) #=> nil
//}...

Hash#slice(*keys) -> Hash (18238.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 ENV.slice...
...引数で指定されたキーとその値だけを含む 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...

String#byteslice(nth) -> String | nil (12225.0)

nth バイト目の文字を返します。nth が負の場合は文字列の末尾から数えます。 引数が範囲外を指定した場合は nil を返します。

...rn 切り出した文字列を返します。戻り値の文字エンコーディングは自身
と同じです。

//emlist[例][ruby]{
"hello".byteslice(1) # => "e"
"hello".byteslice(-1) # => "o"
"\u3042".byteslice(0) # => "\xE3"
"\u3042".byteslice(1) # => "\x81"
//}

@see String#slice...

絞り込み条件を変える

String#byteslice(nth, len=1) -> String | nil (12225.0)

nth バイト目から長さ len バイトの部分文字列を新しく作って返します。 nth が負の場合は文字列の末尾から数えます。引数が範囲外を指定した場合は nil を返します。

...数で指定します。

@return 切り出した文字列を返します。戻り値の文字エンコーディングは自身
と同じです。

//emlist[例][ruby]{
"hello".byteslice(1, 2) # => "el"
"\u3042\u3044\u3046".byteslice(0, 3) # => "\u3042"
//}

@see String#slice...
...

@return 切り出した文字列を返します。戻り値の文字エンコーディングは自身
と同じです。

//emlist[例][ruby]{
"hello".byteslice(1, 2) # => "el"
"\u3042\u3044\u3046".byteslice(0, 3) # => "\u3042"
//}

@see String#slice
@see String#bytesplice...

String#byteslice(range) -> String | nil (12225.0)

range で指定したバイトの範囲に含まれる部分文字列を返します。引数が範囲 外を指定した場合は nil を返します。

...を示す Range オブジェクト

@return 切り出した文字列を返します。戻り値の文字エンコーディングは自身
と同じです。

//emlist[例][ruby]{
"hello".byteslice(1..2) # => "el"
"\x03\u3042\xff".byteslice(1..3) # => "\u3042"
//}

@see String#slice...
...ェクト

@return 切り出した文字列を返します。戻り値の文字エンコーディングは自身
と同じです。

//emlist[例][ruby]{
"hello".byteslice(1..2) # => "el"
"\x03\u3042\xff".byteslice(1..3) # => "\u3042"
//}

@see String#slice
@see String#bytesplice...

Enumerator::Lazy#slice_before {|elt| bool } -> Enumerator::Lazy (9250.0)

Enumerable#slice_before と同じですが、配列ではなく Enumerator::Lazy を返します。

...Enumerable#slice_before と同じですが、配列ではなく Enumerator::Lazy を返します。

//emlist[例][ruby]{
1.step.lazy.slice_before { |e| e.even? }
# => #<Enumerator::Lazy: #<Enumerator: #<Enumerator::Generator:0x00007f9f31844ce8>:each>>

1.step.lazy.slice_before { |e| e % 3 == 0 }.t...
...ake(5).force
# => [[1, 2], [3, 4, 5], [6, 7, 8], [9, 10, 11], [12, 13, 14]]
//}

@see Enumerable#slice_before...

Enumerator::Lazy#slice_before(initial_state) {|elt, state| bool } -> Enumerator::Lazy (9250.0)

Enumerable#slice_before と同じですが、配列ではなく Enumerator::Lazy を返します。

...Enumerable#slice_before と同じですが、配列ではなく Enumerator::Lazy を返します。

//emlist[例][ruby]{
1.step.lazy.slice_before { |e| e.even? }
# => #<Enumerator::Lazy: #<Enumerator: #<Enumerator::Generator:0x00007f9f31844ce8>:each>>

1.step.lazy.slice_before { |e| e % 3 == 0 }.t...
...ake(5).force
# => [[1, 2], [3, 4, 5], [6, 7, 8], [9, 10, 11], [12, 13, 14]]
//}

@see Enumerable#slice_before...
<< 1 2 3 > >>