るりまサーチ

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

別のキーワード

  1. _builtin hash
  2. hash []
  3. matrix hash
  4. dbm to_hash
  5. _builtin to_hash

検索結果

<< < 1 2 >>

TSort#strongly_connected_components -> Array (3018.0)

強連結成分の集まりを配列の配列として返します。 この配列は子から親に向かってソートされています。 各要素は強連結成分を表す配列です。

...by]{
require 'tsort'

class Hash
include TSort
alias tsort_each_node each_key
def tsort_each_child(node, &block)
fetch(node).each(&block)
end
end

non_sort = {1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}

p non_sort.strongly_connected_components
#=> [[4], [2, 3], [1]]
//}

@see TSort.strongly_conne...

1.6.8から1.8.0への変更点(まとめ) (156.0)

1.6.8から1.8.0への変更点(まとめ) * ((<1.6.8から1.8.0への変更点(まとめ)/インタプリタの変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたクラス/モジュール>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたメソッド>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加された定数>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張されたクラス/メソッド(互換性のある変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/変更されたクラス/メソッド(互換性のない変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/文法の変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/正規表現>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Marshal>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Windows 対応>)) * ((<1.6.8から1.8.0への変更点(まとめ)/廃止された(される予定の)機能>)) * ((<1.6.8から1.8.0への変更点(まとめ)/ライブラリ>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張ライブラリAPI>)) * ((<1.6.8から1.8.0への変更点(まとめ)/バグ修正>)) * ((<1.6.8から1.8.0への変更点(まとめ)/サポートプラットフォームの追加>))

...NV/ENV.replace>)) [new]
: ((<ENV/ENV.update>)) [new]

((<Hash>)) との互換性のために定義されました。

=== Enumerable

: ((<Enumerable#partition|Enumerable/partition>)) [new]

追加

: ((<Enumerable#sort_by|Enumerable/sort_by>)) [new]

追加。((<ruby-dev:8986>))以降で...
...[new]

追加。

=== Hash

: ((<Hash#merge|Hash/merge>)) [new]
: ((<Hash#merge!|Hash/merge!>)) [new]

追加。Hash#merge は、hash.dup.update と同じ。
Hash
#merge! は、Hash#update の別名 ((<ruby-talk:59777>)), ((<ruby-dev:19463>))

: ((<Hash#default_proc|Hash/default_proc>)) [new]...
...>)) [new]
: ((<Time#utc_offset|Time/utc_offset>)) [new]

追加

=== その他

: ((<Array#values_at|Array/values_at>)) [new]
: ((<Hash#values_at|Hash/values_at>)) [new]
: ((<ENV/ENV.values_at>)) [new]
: ((<MatchData#values_at|MatchData/values_at>)) [new]
: ((<aStruct#values_at|Struct/valu...

Abbrev.#abbrev(words, pattern = nil) -> Hash (119.0)

文字列の配列から一意に決まる短縮形を計算し、 短縮形をキー、元の文字列を値とするハッシュを返します。

...y]).sort
# => [["ruby", "ruby"]]

# 空白が含まれていても適切に処理します。
pp Abbrev.abbrev(['ru by']).sort
# => [["r", "ru by"],
# ["ru", "ru by"],
# ["ru ", "ru by"],
# ["ru b", "ru by"],
# ["ru by", "ru by"]]
# sort...

Ruby用語集 (96.0)

Ruby用語集 A B C D E F G I J M N O R S Y

...ンの
間でオブジェクトにアクセスできる。

===[a:E] E

: ENV
環境変数にアクセスするためのオブジェクト。
Hash
に似たインターフェースを持つ。キーも値も文字列である。
ENV で環境変数を変更すると Ruby の子プロセス...
...ち演算子」とも呼ばれる。

: 安定ソート
: stable sort
同順位となる二つの要素の順序がソート前後で保たれるソート。

Enumerable#sort などのメソッドは非安定ソート(unstable sort)である。

: 委譲
: delegation
あるオブジェク...
...「可変長引数」という用語の
ほうが普及している。

英語の variadic は形容詞である。

: 空
: empty
Array や Hash、Struct のような要素を持つクラスでは、要素が無いことを
「空(から)」と呼ぶ。

また、String クラスで...

NEWS for Ruby 3.0.0 (78.0)

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

...duler hooks in a non-blocking 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 a...
...cant overhead to major collections, so please 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#n...
...* IRB
* Update to IRB 1.2.6
* JSON
* Update to JSON 2.5.0
* This version is Ractor compatible.
* Set
* Update to set 1.0.0
* SortedSet has been removed for dependency and performance reasons.
* Set#join is added as a shorthand for `.to_a.join`.
* Set#<=> is added.
*...

絞り込み条件を変える

rss (60.0)

RSS を扱うためのライブラリです。

...MLStyleSheet.new(...)

RSS::XMLStyleSheet.newには以下のようなHashまたは
連想配列を渡します.作成されるRSS::XMLStyleSheetオブジェ
クトは与えられた引数によって初期化されます.

Hash
:

{
:href => "...",
:type => "...",
:title => "...",...
...04/11/2 10:10")
end
end

===== エントリを並び替える

もし,更新日が新しい順に並び替えたければ

maker.items.do_sort = true

を追加し,以下のようにします.

require "rss"

rss = RSS::Maker.make("1.0") do |maker|
maker.channel.about = "http:/...
...maker.channel.title = "Example"
maker.channel.description = "Example Site"
maker.channel.link = "http://example.com/"

maker.items.do_sort = true

maker.items.new_item do |item|
item.link = "http://example.com/article.html"
item.title = "Sample Article"
item.date...

yaml (54.0)

構造化されたデータを表現するフォーマットであるYAML (YAML Ain't Markup Language) を扱うためのライブラリです。

...time: 2008-02-24 17:00:35 +09:00
target: YAML
version: 3
log: |
アブストラクトを書いた。

YAML_EOT

YAML.load_stream(strio_r).sort_by{ |a| a["version"] }.each do |obj|
puts "version %d\ntime %s\ntarget:%s\n%s\n" % obj.values_at("version", "time", "target", "log")
end

# =>
#...
...けに以下のローカルタグを扱えます。

* !ruby/array: Array オブジェクト
* !ruby/class: Class オブジェクト
* !ruby/hash: Hash オブジェクト
* !ruby/module: Module オブジェクト
* !ruby/regexp: Regexp オブジェクト
* !ruby/range: Range オブジェク...
...[例][ruby]{
require 'yaml'
p YAML.load(<<~EOS)
---
array: !ruby/array [1, 2, 3]
hash
: !ruby/hash {foo: 1, bar: 2}
regexp: !ruby/regexp /foo|bar/
range: !ruby/range 1..10
EOS
# => {"regexp"=>/foo|bar/, "hash"=>{"foo"=>1, "bar"=>2}, "array"=>[1, 2, 3], "range"=>1..10}
//}

これらは tag:...

Open3.#pipeline_rw(*cmds) -> [IO, IO, [Thread]] (30.0)

指定したコマンドのリストをパイプで繋いで順番に実行します。最初の コマンドの標準入力に書き込む事も最後のコマンドの標準出力を受けとる事も できます。

...コマンド全体(例. "nroff -man")を表す
String を指定します。
options には Hash で指定します。
env には環境変数を Hash で指定します。
cmdname にはコマンド名を表す String を指定します。
1...
...require "open3"

Open3.pipeline_rw("sort", "cat -n") {|stdin, stdout, wait_thrs|
stdin.puts "foo"
stdin.puts "bar"
stdin.puts "baz"

# sortコマンドにEOFを送る。
stdin.close

# stdinに渡した文字列をsortコマンドが並べ替えたものに、c...

Open3.#pipeline_rw(*cmds) {|first_stdin, last_stdout, wait_thrs| ... } -> () (30.0)

指定したコマンドのリストをパイプで繋いで順番に実行します。最初の コマンドの標準入力に書き込む事も最後のコマンドの標準出力を受けとる事も できます。

...コマンド全体(例. "nroff -man")を表す
String を指定します。
options には Hash で指定します。
env には環境変数を Hash で指定します。
cmdname にはコマンド名を表す String を指定します。
1...
...require "open3"

Open3.pipeline_rw("sort", "cat -n") {|stdin, stdout, wait_thrs|
stdin.puts "foo"
stdin.puts "bar"
stdin.puts "baz"

# sortコマンドにEOFを送る。
stdin.close

# stdinに渡した文字列をsortコマンドが並べ替えたものに、c...
<< < 1 2 >>