るりまサーチ

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

別のキーワード

  1. _builtin **
  2. matrix **
  3. bigdecimal **
  4. rational **
  5. bn **

ライブラリ

モジュール

キーワード

検索結果

Enumerable#uniq -> Array (18126.0)

self から重複した値を取り除いた配列を返します。

...][ruby]{
olympics = {
1896 => 'Athens',
1900 => 'Paris',
1904 => 'Chicago',
1906 => 'Athens',
1908 => 'Rome',
}
olympics.uniq{|k,v| v} # => [[1896, "Athens"], [1900, "Paris"], [1904, "Chicago"], [1908, "Rome"]]

(1..100).uniq{|x| (x**2) % 10 } # => [1, 2, 3, 4, 5, 10]
//}

@see Array#uniq...

Enumerable#uniq { |item| ... } -> Array (18126.0)

self から重複した値を取り除いた配列を返します。

...][ruby]{
olympics = {
1896 => 'Athens',
1900 => 'Paris',
1904 => 'Chicago',
1906 => 'Athens',
1908 => 'Rome',
}
olympics.uniq{|k,v| v} # => [[1896, "Athens"], [1900, "Paris"], [1904, "Chicago"], [1908, "Rome"]]

(1..100).uniq{|x| (x**2) % 10 } # => [1, 2, 3, 4, 5, 10]
//}

@see Array#uniq...

ruby 1.6 feature (18.0)

ruby 1.6 feature ruby version 1.6 は安定版です。この版での変更はバグ修正がメイン になります。

...2

: String#succ

((<ruby-talk:22557>))

p "***".succ
p "*".succ
p sprintf("%c", 255).succ
p sprintf("*%c", 255).succ
p sprintf("**%c", 255).succ

=> ruby 1.6.5 (2001-09-19) [i586-linux]
"**+"
"\001+"
"\001\000"...
..."\001+\000"
"*+\000"

=> ruby 1.6.5 (2001-11-01) [i586-linux]
"**+"
"+"
"\001\000"
"+\000"
"*+\000"

: method_missing

以下が Segmentation Fault していました。((<ruby-dev:14942>))

Module.constants.each...
...(<Array>))#|
: ((<Array>))#uniq

結果の配列の要素が freeze され変更不可になっていました。((<ruby-list:29665>))

(%w(foo bar) & %w(foo baz))[0].upcase!
=> -:1:in `upcase!': can't modify frozen string (TypeError)

%w(foo bar bar baz).uniq[0].upcase!
=> -:1:in...

Enumerator::Lazy (12.0)

map や select などのメソッドの遅延評価版を提供するためのクラス。

...select/find_all
* reject
* grep, grep_v
* take, take_while
* drop, drop_while
* slice_before, slice_after, slice_when
* chunk, chunk_while
* uniq
* zip (※互換性のため、ブロックを渡さないケースのみlazy)

Lazyオブジェクトは、Enumerable#lazyメソッドによっ...
...びます。

//emlist[例][ruby]{
# 二乗して偶数になるような整数を、小さい方から5個表示する
p 1.step.lazy.select{|n| (n**2).even?}.first(5)
# LTSV (http://ltsv.org/) 形式のログファイルから検索を行う
# Enumerator::Lazy#map は配列ではなく Enumerator...
...select/find_all
* reject
* grep, grep_v
* take, take_while
* drop, drop_while
* slice_before, slice_after, slice_when
* chunk, chunk_while
* uniq
* compact
* zip (※互換性のため、ブロックを渡さないケースのみlazy)

Lazyオブジェクトは、Enumerable#lazyメソッ...

NEWS for Ruby 3.0.0 (12.0)

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

...osplatting. This now matches the behavior of Procs
accepting a single rest argument and no keywords.
16166

//emlist[][ruby]{
pr = proc{|*a, **kw| [a, kw]}

pr.call([1])
# 2.7 => [[1], {}]
# 3.0 => [[[1]], {}]

pr.call([1, {a: 1}])
# 2.7 => [[1], {:a=>1}] # and deprecation warning
# 3.0 =>...
...hile
* 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 = ['--', 'data1', '--', 'data2', '--', 'data3']
dirty_da...
...The following methods now return or yield String instances instead of subclass instances when called on subclass instances: 10845
* String#*
*
String#capitalize
* String#center
* String#chomp
* String#chop
* String#delete
* String#delete_prefix
* Stri...

絞り込み条件を変える