ライブラリ
- ビルトイン (319)
- csv (121)
- forwardable (11)
- json (55)
-
json
/ add / exception (11) -
net
/ http (33) - rake (11)
- rbconfig (11)
-
rubygems
/ commands / dependency _ command (11) -
rubygems
/ dependency _ installer (11) -
rubygems
/ dependency _ list (11) - tsort (43)
- win32ole (11)
クラス
- CSV (121)
- Data (2)
-
Encoding
:: Converter (44) -
Enumerator
:: ArithmeticSequence (6) - Exception (11)
-
Gem
:: Commands :: DependencyCommand (11) -
Gem
:: DependencyInstaller (11) -
Gem
:: DependencyList (11) - Hash (11)
- IO (154)
-
JSON
:: Parser (11) - KeyError (7)
- Module (5)
- Object (22)
-
Rake
:: TaskArguments (11) - Range (11)
- String (11)
- Struct (2)
- Thread (11)
モジュール
- Forwardable (11)
- JSON (22)
-
JSON
:: Generator :: GeneratorMethods :: Object (11) -
JSON
:: Generator :: GeneratorMethods :: String :: Extend (11) - Kernel (22)
-
Net
:: HTTPHeader (33) - RbConfig (11)
- TSort (43)
キーワード
- % (11)
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (11) -
DEFAULT
_ OPTIONS (11) -
MAKEFILE
_ CONFIG (11) - Marshal フォーマット (11)
-
NEWS for Ruby 2
. 1 . 0 (11) -
NEWS for Ruby 2
. 7 . 0 (5) -
NEWS for Ruby 3
. 0 . 0 (4) - Numeric (11)
- Ruby用語集 (11)
- WIN32OLE (11)
- cgi (11)
-
cgi
/ session (11) -
deconstruct
_ keys (2) -
each
_ strongly _ connected _ component (11) -
each
_ strongly _ connected _ component _ from (21) - fetch (33)
- filter (33)
-
find
_ gems (11) - format (11)
- generate (22)
-
handle
_ interrupt (11) -
instance
_ delegate (11) - invert (11)
-
is
_ a? (11) -
json
_ create (11) -
kind
_ of? (11) - new (24)
- open (44)
- parse (22)
- popen (154)
-
primitive
_ convert (44) - rdoc (11)
- receiver (7)
-
ruby 1
. 6 feature (11) -
ruby 1
. 8 . 2 feature (11) -
ruby 1
. 8 . 4 feature (11) -
ruby 1
. 9 feature (11) -
ruby2
_ keywords (5) -
spec
_ predecessors (11) - sprintf (11)
- sprintf フォーマット (11)
-
to
_ json (22) - tsort (11)
-
tsort
_ each (11) - unparse (11)
-
webrick
/ cgi (11) -
with
_ defaults (11) - メソッド呼び出し(super・ブロック付き・yield) (11)
- リテラル (11)
検索結果
先頭5件
-
Enumerator
:: ArithmeticSequence # hash -> Integer (21213.0) -
自身のハッシュ値を返します。
...自身のハッシュ値を返します。
begin, end, step, exclude_end? が等しい Enumerable::ArithmeticSequence は
同じハッシュ値を返します。... -
Range
# hash -> Integer (18229.0) -
始端と終端のハッシュ値と Range#exclude_end? の値からハッシュ値を計算して整数として返します。
...始端と終端のハッシュ値と Range#exclude_end? の値からハッシュ値を計算して整数として返します。
//emlist[例][ruby]{
p (1..2).hash # => 5646
p (1...2).hash # => 16782863
//}... -
Hash
# invert -> Hash (15237.0) -
値からキーへのハッシュを作成して返します。
...//emlist[例][ruby]{
h = { "a" => 0, "b" => 100, "c" => 200, "d" => 300, "e" => 300 }
p h.invert #=> {0=>"a", 100=>"b", 200=>"c", 300=>"e"}
//}
=== 参考
値が重複していたときに備えて、変換後の値を配列として保持するには、次のようにします。
//emlist[][r......uby]{
def safe_invert(orig_hash)
orig_hash.each_key.group_by do |key|
orig_hash[key]
end
end
p safe_invert({"a"=>1, "b"=>1, "c"=>3}) # => {1=>["a", "b"], 3=>["c"]}
//}
@see Hash#key... -
Gem
:: Commands :: DependencyCommand # find _ gems(name , source _ index) -> Hash (9301.0) -
与えられた Gem の名前をインデックスから検索します。
...与えられた Gem の名前をインデックスから検索します。
@param name Gem の名前を指定します。
@param source_index Gem::SourceIndex のインスタンスを指定します。
@see Gem::SourceIndex#search... -
RbConfig
:: MAKEFILE _ CONFIG -> Hash (9213.0) -
RbConfig::CONFIG と同じですが、その値は以下のような形 で他の変数への参照を含みます。 MAKEFILE_CONFIG["bindir"] = "$(exec_prefix)/bin" これは、Makefile の変数参照の形式で MAKEFILE_CONFIG は、 Makefile 作成の際に利用されることを想定しています。
...RbConfig::CONFIG
と同じですが、その値は以下のような形
で他の変数への参照を含みます。
MAKEFILE_CONFIG["bindir"] = "$(exec_prefix)/bin"
これは、Makefile の変数参照の形式で MAKEFILE_CONFIG は、
Makefile 作成の際に利用されることを想定し......require 'rbconfig'
print <<-END_OF_MAKEFILE
prefix = #{RbConfig::MAKEFILE_CONFIG['prefix']}
exec_prefix = #{RbConfig::MAKEFILE_CONFIG['exec_prefix']}
bindir = #{RbConfig::MAKEFILE_CONFIG['bindir']}
END_OF_MAKEFILE
=> prefix = /usr/local
exec_prefix = $(prefix)
bindir = $......fix)/bin
RbConfig.expand
は、このような参照を解決する
メソッドとして rbconfig 内部で利用されています。
(CONFIG 変数は、MAKEFILE_CONFIG の内容から
RbConfig.expand
を使って生成されています)
require 'rbconfig'
p Config.expand(RbConfig::MAKEFIL... -
Gem
:: DependencyInstaller :: DEFAULT _ OPTIONS -> Hash (9201.0) -
自身を初期化する際に使用するデフォルトのオプションです。
...:env_shebang => false,
:domain => :both, # HACK dup
:force => false,
:format_executable => false, # HACK dup
:ignore_dependencies => false,
:security_policy => nil, # HACK NoSecurity requires OpenSSL. AlmostNo? Low?
:wrappers... -
Thread
. handle _ interrupt(hash) { . . . } -> object (6231.0) -
スレッドの割り込みのタイミングを引数で指定した内容に変更してブロックを 実行します。
...み」とは、非同期イベントや Thread#raise や
Thread#kill、Signal.#trap(未サポート)、メインスレッドの終了
(メインスレッドが終了すると、他のスレッドも終了されます)を意味します。
@param hash 例外クラスがキー、割り込みのタイ......ミングを指定する
Symbol が値の Hash を指定します。
値の内容は以下のいずれかです。
: :immediate
すぐに割り込みます。
: :on_blocking
ブロッキング処理(後述)の間は割り込みが発生します。
: :never
まっ......read.handle_interrupt(RuntimeError => :never) {
begin
# 安全にリソースの割り当てが可能
Thread.handle_interrupt(RuntimeError => :immediate) {
# ...
}
ensure
# 安全にリソースの解放が可能
end
}
end
Thread.pa... -
CSV
. filter(input , options = Hash . new) {|row| . . . } (6227.0) -
このメソッドは CSV データに対して Unix のツール群のようなフィルタを構築 するのに便利です。
...このメソッドは CSV データに対して Unix のツール群のようなフィルタを構築
するのに便利です。
与えられたブロックに一行ずつ渡されます。ブロックに渡された行は必要であ
れば変更することができます。ブロックの評......param input String か IO のインスタンスを指定します。
デフォルトは ARGF です。
@param output String か IO のインスタンスを指定します。
デフォルトは $stdout です。
@param options ":in_", ":input_" で始まるキーは input......//emlist[例: input, output は初期値][ruby]{
# $ echo "header1,header2\nrow1_1,row1_2" > in.csv; ruby test.rb in.csv
require "csv"
options = { headers: true, return_headers: true, write_headers: true }
CSV.filter(options) do |row|
if row.header_row?
row << "header3"
next
end
ro... -
CSV
. filter(input , output , options = Hash . new) {|row| . . . } (6227.0) -
このメソッドは CSV データに対して Unix のツール群のようなフィルタを構築 するのに便利です。
...このメソッドは CSV データに対して Unix のツール群のようなフィルタを構築
するのに便利です。
与えられたブロックに一行ずつ渡されます。ブロックに渡された行は必要であ
れば変更することができます。ブロックの評......param input String か IO のインスタンスを指定します。
デフォルトは ARGF です。
@param output String か IO のインスタンスを指定します。
デフォルトは $stdout です。
@param options ":in_", ":input_" で始まるキーは input......//emlist[例: input, output は初期値][ruby]{
# $ echo "header1,header2\nrow1_1,row1_2" > in.csv; ruby test.rb in.csv
require "csv"
options = { headers: true, return_headers: true, write_headers: true }
CSV.filter(options) do |row|
if row.header_row?
row << "header3"
next
end
ro... -
CSV
. filter(options = Hash . new) {|row| . . . } (6227.0) -
このメソッドは CSV データに対して Unix のツール群のようなフィルタを構築 するのに便利です。
...このメソッドは CSV データに対して Unix のツール群のようなフィルタを構築
するのに便利です。
与えられたブロックに一行ずつ渡されます。ブロックに渡された行は必要であ
れば変更することができます。ブロックの評......param input String か IO のインスタンスを指定します。
デフォルトは ARGF です。
@param output String か IO のインスタンスを指定します。
デフォルトは $stdout です。
@param options ":in_", ":input_" で始まるキーは input......//emlist[例: input, output は初期値][ruby]{
# $ echo "header1,header2\nrow1_1,row1_2" > in.csv; ruby test.rb in.csv
require "csv"
options = { headers: true, return_headers: true, write_headers: true }
CSV.filter(options) do |row|
if row.header_row?
row << "header3"
next
end
ro...