ライブラリ
- ビルトイン (35)
- csv (2)
- fileutils (22)
- kconv (2)
-
rake
/ packagetask (1) -
rubygems
/ dependency _ installer (2) -
rubygems
/ installer (1) -
win32
/ registry (2)
クラス
- CSV (2)
- Encoding (2)
-
Encoding
:: Converter (5) -
Enumerator
:: Lazy (22) -
Gem
:: DependencyInstaller (2) -
Gem
:: Installer (1) -
RDoc
:: Options (3) -
Rake
:: PackageTask (1) - Regexp (1)
- String (3)
モジュール
- Enumerable (1)
- FileUtils (21)
-
Gem
:: InstallUpdateOptions (1) - Kconv (1)
-
Win32
:: Registry :: Constants (2)
キーワード
-
DEFAULT
_ OPTIONS (2) - FileUtils (1)
- InvalidByteSequenceError (1)
- Lazy (1)
-
REG
_ NO _ LAZY _ FLUSH (1) -
REG
_ WHOLE _ HIVE _ VOLATILE (1) - chunk (2)
- collect (1)
-
collect
_ concat (1) - compatible? (1)
-
cp
_ r (1) - drop (1)
-
drop
_ while (1) -
find
_ all (1) -
fixed
_ encoding? (1) -
flat
_ map (1) -
force
_ encoding (1) -
force
_ output (1) -
force
_ output= (1) -
force
_ quotes? (1) -
force
_ update (1) - grep (1)
-
insert
_ output (1) -
install
_ update _ defaults _ str (1) - iseuc (1)
- isjis (1)
- lazy (1)
- link (1)
- ln (1)
-
ln
_ s (1) -
ln
_ sf (1) - map (1)
- move (1)
- mv (1)
- new (4)
-
primitive
_ convert (4) -
rb
_ gc _ force _ recycle (1) - reject (1)
- remove (1)
-
remove
_ dir (1) -
remove
_ entry (1) -
remove
_ entry _ secure (1) -
remove
_ file (1) - replicate (1)
- rm (1)
-
rm
_ f (1) -
rm
_ r (1) -
rm
_ rf (1) - rmtree (1)
-
ruby 1
. 8 . 2 feature (1) -
rubygems
/ commands / install _ command (1) -
rubygems
/ commands / uninstall _ command (1) -
safe
_ unlink (1) - select (1)
-
slice
_ before (3) - symlink (1)
- take (1)
-
take
_ while (2) -
valid
_ encoding? (1) - zip (2)
検索結果
先頭5件
-
Enumerator
:: Lazy # force(*args) -> [object] (63322.0) -
全ての要素を含む配列を返します。Lazy から実際に値を取り出すのに使います。
全ての要素を含む配列を返します。Lazy から実際に値を取り出すのに使います。
Enumerable#to_a のエイリアスです。
//emlist[例][ruby]{
1.step.lazy.take(10).force
# => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
1.step.lazy.take(10).to_a
# => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
//} -
void rb
_ gc _ force _ recycle(VALUE p) (36601.0) -
p を強制的に GC します。
p を強制的に GC します。 -
FileUtils
. # remove _ file(path , force = false) -> () (27622.0) -
ファイル path を削除します。
ファイル path を削除します。
@param path 削除するファイル。
@param force 真のときは削除中に発生した StandardError を無視します。 -
Win32
:: Registry :: Constants :: REG _ WHOLE _ HIVE _ VOLATILE (27604.0) -
@todo
@todo -
Gem
:: InstallUpdateOptions # install _ update _ defaults _ str -> String (27319.0) -
Gem コマンドの install サブコマンドに渡されるデフォルトのオプションを返します。
Gem コマンドの install サブコマンドに渡されるデフォルトのオプションを返します。
デフォルトのオプションは以下の通りです。
--rdoc --no-force --no-test --wrappers -
RDoc
:: Options # force _ output -> bool (18700.0) -
コマンドライン引数の --force_output オプションを指定していた場合、true を返します。--no-force_output オプションを指定していた場合、false を返 します。
コマンドライン引数の --force_output オプションを指定していた場合、true
を返します。--no-force_output オプションを指定していた場合、false を返
します。
どちらも指定しなかった場合は true を返します。 -
CSV
# force _ quotes? -> bool (18676.0) -
出力される全てのフィールドがクオートされる場合は、真を返します。
出力される全てのフィールドがクオートされる場合は、真を返します。
//emlist[例][ruby]{
require "csv"
rows = [["header1", "header2"], ["row1_1,", "row1_2"]]
result = CSV.generate(force_quotes: false) do |csv|
rows.each { |row| csv << row }
csv.force_quotes? # => false
end
print result
# => header1,header2
# "row1_1,",row1_2... -
String
# force _ encoding(encoding) -> self (18676.0) -
文字列の持つエンコーディング情報を指定された encoding に変えます。
文字列の持つエンコーディング情報を指定された encoding に変えます。
このとき実際のエンコーディングは変換されず、検査もされません。
Array#pack などで得られたバイト列のエンコーディングを指定する時に使います。
@param encoding 変更するエンコーディング情報を表す文字列か Encoding オブジェクトを指定します。
//emlist[例][ruby]{
s = [164, 164, 164, 237, 164, 207].pack("C*")
p s.encoding #=> ASC... -
RDoc
:: Options # force _ output=(val) (18670.0) -
val に true を指定した場合、コマンドライン引数の --force_output オプショ ンと同様の指定を行います。
val に true を指定した場合、コマンドライン引数の --force_output オプショ
ンと同様の指定を行います。
@param val --force_output オプションと同じ指定を行う場合は true、そうで
ない場合は false を指定します。 -
FileUtils
. # safe _ unlink(list , options = {}) -> () (18667.0) -
FileUtils.rm(list, force: true) と同じです。
FileUtils.rm(list, force: true) と同じです。
c:FileUtils#options
@param list 削除する対象。一つの場合は文字列も指定可能です。
二つ以上指定する場合は配列で指定します。
@param options :noop, :verbose が指定できます。
:force がセットされた場合は作業中すべての StandardError を無視します。
@see FileUtils.#rm -
Enumerable
# lazy -> Enumerator :: Lazy (18655.0) -
自身を lazy な Enumerator に変換したものを返します。
自身を lazy な Enumerator に変換したものを返します。
この Enumerator は、以下のメソッドが遅延評価を行う (つまり、配列ではな
くEnumeratorを返す) ように再定義されています。
* map/collect
* flat_map/collect_concat
* select/find_all
* reject
* grep
* take, take_while
* drop, drop_while
* zip (※一貫性のため、ブロックを渡さないケースのみlazy)
* cycle (※一貫性のため、ブロックを渡さないケースのみl... -
Enumerator
:: Lazy # flat _ map {|item| . . . } -> Enumerator :: Lazy (18655.0) -
ブロックの実行結果をひとつに繋げたものに対してイテレートするような Enumerator::Lazy のインスタンスを返します。
ブロックの実行結果をひとつに繋げたものに対してイテレートするような
Enumerator::Lazy のインスタンスを返します。
//emlist[][ruby]{
["foo", "bar"].lazy.flat_map {|i| i.each_char.lazy}.force
#=> ["f", "o", "o", "b", "a", "r"]
//}
ブロックの返した値 x は、以下の場合にのみ分解され、連結されます。
* x が配列であるか、to_ary メソッドを持つとき
* x が each および force メソッドを持つ (例:Enumerator::Lazy) ... -
RDoc
:: Options # force _ update -> bool (18652.0) -
コマンドライン引数の --force_update を指定していた場合に true を返しま す。そうでない場合は false を返します。
コマンドライン引数の --force_update を指定していた場合に true を返しま
す。そうでない場合は false を返します。 -
Encoding
# replicate(name) -> Encoding (18355.0) -
レシーバのエンコーディングを複製(replicate)します。 複製されたエンコーディングは元のエンコーディングと同じバイト構造を持たなければなりません。 name という名前のエンコーディングが既に存在する場合は ArgumentError を発生します。
レシーバのエンコーディングを複製(replicate)します。
複製されたエンコーディングは元のエンコーディングと同じバイト構造を持たなければなりません。
name という名前のエンコーディングが既に存在する場合は ArgumentError を発生します。
Ruby 3.2 から非推奨となり、Ruby 3.3 で削除予定です。
//emlist[][ruby]{
encoding = Encoding::UTF_8.replicate("REPLICATED_UTF-8") #=> #<Encoding:REPLICATED_UTF-8>
encoding.name ... -
Encoding
. compatible?(obj1 , obj2) -> Encoding | nil (18355.0) -
2つのオブジェクトのエンコーディングに関する互換性をチェックします。 互換性がある場合はそのエンコーディングを、 ない場合は nil を返します。
2つのオブジェクトのエンコーディングに関する互換性をチェックします。
互換性がある場合はそのエンコーディングを、
ない場合は nil を返します。
引数が両方とも文字列である場合、互換性があるならば
その文字列を結合できます。この場合返り値のエンコーディングは
結合した文字列が取るであろう Encoding オブジェクトを返します。
//emlist[例][ruby]{
Encoding.compatible?("\xa1".force_encoding("iso-8859-1"), "b")
#=> #<Encoding:ISO-8859-1>
Encoding.compatible?... -
Enumerator
:: Lazy # collect _ concat {|item| . . . } -> Enumerator :: Lazy (18355.0) -
ブロックの実行結果をひとつに繋げたものに対してイテレートするような Enumerator::Lazy のインスタンスを返します。
ブロックの実行結果をひとつに繋げたものに対してイテレートするような
Enumerator::Lazy のインスタンスを返します。
//emlist[][ruby]{
["foo", "bar"].lazy.flat_map {|i| i.each_char.lazy}.force
#=> ["f", "o", "o", "b", "a", "r"]
//}
ブロックの返した値 x は、以下の場合にのみ分解され、連結されます。
* x が配列であるか、to_ary メソッドを持つとき
* x が each および force メソッドを持つ (例:Enumerator::Lazy) ... -
FileUtils
. # ln _ s(src , dest , options = {}) -> () (18355.0) -
src へのシンボリックリンク dest を作成します。
src へのシンボリックリンク dest を作成します。
src が一つの場合、
dest がすでに存在しディレクトリであるときは dest/src を作成します。
dest がすでに存在しディレクトリでないならば例外 Errno::EEXIST が発生します。
ただし :force オプションを指定したときは dest を上書きします。
src が複数の場合、
src[0] へのシンボリックリンク dest/src[0]、src[1] への
シンボリックリンク dest/src[1] …を作成します。
dest がディレクトリでない場合は例外 Errno::ENOTDIR が発生します... -
FileUtils
. # symlink(src , dest , options = {}) -> () (18355.0) -
src へのシンボリックリンク dest を作成します。
src へのシンボリックリンク dest を作成します。
src が一つの場合、
dest がすでに存在しディレクトリであるときは dest/src を作成します。
dest がすでに存在しディレクトリでないならば例外 Errno::EEXIST が発生します。
ただし :force オプションを指定したときは dest を上書きします。
src が複数の場合、
src[0] へのシンボリックリンク dest/src[0]、src[1] への
シンボリックリンク dest/src[1] …を作成します。
dest がディレクトリでない場合は例外 Errno::ENOTDIR が発生します... -
String
# valid _ encoding? -> bool (18355.0) -
文字列の内容が、現在のエンコーディングに照らしあわせて妥当であれば true を返します。さもなくば false を返します。
文字列の内容が、現在のエンコーディングに照らしあわせて妥当であれば
true を返します。さもなくば false を返します。
//emlist[例][ruby]{
"\xc2\xa1".force_encoding("UTF-8").valid_encoding? #=> true
"\xc2".force_encoding("UTF-8").valid_encoding? #=> false
"\x80".force_encoding("UTF-8").valid_encoding? #=> false
//} -
FileUtils
. # link(src , dest , options = {}) -> () (18337.0) -
src へのハードリンク dest を作成します。
src へのハードリンク dest を作成します。
src が一つの場合、
dest がすでに存在しディレクトリであるときは dest/src を作成します。
dest がすでに存在しディレクトリでないならば例外 Errno::EEXIST が発生します。
ただし :force オプションを指定したときは dest を上書きします。
src が複数の場合、
src[0] へのハードリンク dest/src[0]、src[1] への
ハードリンク dest/src[1] …を作成します。
dest がディレクトリでない場合は例外 Errno::ENOTDIR が発生します。
@param... -
FileUtils
. # ln(src , dest , options = {}) -> () (18337.0) -
src へのハードリンク dest を作成します。
src へのハードリンク dest を作成します。
src が一つの場合、
dest がすでに存在しディレクトリであるときは dest/src を作成します。
dest がすでに存在しディレクトリでないならば例外 Errno::EEXIST が発生します。
ただし :force オプションを指定したときは dest を上書きします。
src が複数の場合、
src[0] へのハードリンク dest/src[0]、src[1] への
ハードリンク dest/src[1] …を作成します。
dest がディレクトリでない場合は例外 Errno::ENOTDIR が発生します。
@param... -
FileUtils
. # ln _ sf(src , dest , options = {}) -> () (18337.0) -
src へのシンボリックリンク dest を作成します。
src へのシンボリックリンク dest を作成します。
ln_s(src, dest, force: true) と同じです。
@param src リンク元。一つの場合は文字列でも指定可能です。
二つ以上指定する場合は配列で指定します。
@param dest リンク作成先のファイルかディレクトリです。
@param options :force, :noop, :verbose が指定できます。
c:FileUtils#options
@raise Errno::ENOTDIR src が複数で dest がディレクトリでな... -
CSV
:: DEFAULT _ OPTIONS -> Hash (18319.0) -
このオプションは呼び出し側で上書きしなかったときに使用するオプションです。
このオプションは呼び出し側で上書きしなかったときに使用するオプションです。
: :col_sep
","
: :row_sep
:auto
: :quote_char
'"'
: :field_size_limit
nil
: :converters
nil
: :unconverted_fields
nil
: :headers
false
: :return_headers
false
: :header_converters
nil
: :skip_blanks
false
: :force_quotes
false
: :skip_lin... -
Enumerator
:: Lazy # collect {|item| . . . } -> Enumerator :: Lazy (18319.0) -
Enumerable#map と同じですが、配列ではなくEnumerator::Lazy を返します。
Enumerable#map と同じですが、配列ではなくEnumerator::Lazy を返します。
@raise ArgumentError ブロックを指定しなかった場合に発生します。
//emlist[例][ruby]{
1.step.lazy.map{ |n| n % 3 == 0 }
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: 1:step>>:map>
1.step.lazy.collect{ |n| n.succ }.take(10).force
# => [2, 3, 4, 5, 6, 7, 8,... -
Enumerator
:: Lazy # drop _ while {|item| . . . } -> Enumerator :: Lazy (18319.0) -
Enumerable#drop_while と同じですが、配列ではなくEnumerator::Lazy を返します。
Enumerable#drop_while と同じですが、配列ではなくEnumerator::Lazy を返します。
//emlist[例][ruby]{
1.step.lazy.drop_while { |i| i < 42 }
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: 1:step>>:drop_while>
1.step.lazy.drop_while { |i| i < 42 }.take(10).force
# => [42, 43, 44, 45, 46, 47, 48, 49, 50, 51]
//... -
Enumerator
:: Lazy # find _ all {|item| . . . } -> Enumerator :: Lazy (18319.0) -
Enumerable#select と同じですが、配列ではなくEnumerator::Lazy を返します。
Enumerable#select と同じですが、配列ではなくEnumerator::Lazy を返します。
@raise ArgumentError ブロックを指定しなかった場合に発生します。
//emlist[例][ruby]{
1.step.lazy.find_all { |i| i.even? }
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: 1:step>>:find_all>
1.step.lazy.select { |i| i.even? }.take(10).force
# => [2, 4, 6,... -
Enumerator
:: Lazy # select {|item| . . . } -> Enumerator :: Lazy (18319.0) -
Enumerable#select と同じですが、配列ではなくEnumerator::Lazy を返します。
Enumerable#select と同じですが、配列ではなくEnumerator::Lazy を返します。
@raise ArgumentError ブロックを指定しなかった場合に発生します。
//emlist[例][ruby]{
1.step.lazy.find_all { |i| i.even? }
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: 1:step>>:find_all>
1.step.lazy.select { |i| i.even? }.take(10).force
# => [2, 4, 6,... -
Enumerator
:: Lazy # slice _ before {|elt| bool } -> Enumerator :: Lazy (18319.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 }.take(5).force
# => [[1, 2], [3, 4, 5], [6... -
Enumerator
:: Lazy # slice _ before(initial _ state) {|elt , state| bool } -> Enumerator :: Lazy (18319.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 }.take(5).force
# => [[1, 2], [3, 4, 5], [6... -
Enumerator
:: Lazy # slice _ before(pattern) -> Enumerator :: Lazy (18319.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 }.take(5).force
# => [[1, 2], [3, 4, 5], [6... -
Enumerator
:: Lazy # take _ while -> Enumerator :: Lazy (18319.0) -
Enumerable#take_while と同じですが、配列ではなくEnumerator::Lazy を返します。
Enumerable#take_while と同じですが、配列ではなくEnumerator::Lazy を返します。
//emlist[例][ruby]{
1.step.lazy.zip(('a'..'z').cycle).take_while { |e| e.first < 100_000 }
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: 1:step>>:zip(#<Enumerator: "a".."z":cycle>)>:take_while>
1.step.lazy.... -
Enumerator
:: Lazy # take _ while {|item| . . . } -> Enumerator :: Lazy (18319.0) -
Enumerable#take_while と同じですが、配列ではなくEnumerator::Lazy を返します。
Enumerable#take_while と同じですが、配列ではなくEnumerator::Lazy を返します。
//emlist[例][ruby]{
1.step.lazy.zip(('a'..'z').cycle).take_while { |e| e.first < 100_000 }
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: 1:step>>:zip(#<Enumerator: "a".."z":cycle>)>:take_while>
1.step.lazy.... -
Gem
:: DependencyInstaller :: DEFAULT _ OPTIONS -> Hash (18319.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. Al... -
Win32
:: Registry :: Constants :: REG _ NO _ LAZY _ FLUSH (18304.0) -
@todo
@todo -
rubygems
/ commands / install _ command (18055.0) -
Gem パッケージをローカルリポジトリにインストールするためのライブラリです。
Gem パッケージをローカルリポジトリにインストールするためのライブラリです。
Usage: gem install GEMNAME [GEMNAME ...] [options] -- --build-flags [options]
Options:
--platform PLATFORM 指定されたプラットフォームの Gem パッケージをインストールします
-v, --version VERSION 指定されたバージョンの Gem パッケージをインストールします
Install/Update Op... -
Encoding
:: InvalidByteSequenceError (18037.0) -
文字列がそのエンコーディングにおいて不正なバイト列である場合に発生 する例外。
文字列がそのエンコーディングにおいて不正なバイト列である場合に発生
する例外。
通常エンコーディング変換時に発生します。
//emlist[例][ruby]{
"\x82\xa0".force_encoding("cp932").encode("UTF-8")
#=> "あ"
"\x82\xa0".force_encoding("EUC-JP").encode("UTF-8")
#=> Encoding::InvalidByteSequenceError: "\x82" on EUC-JP
//} -
Enumerator
:: Lazy (18019.0) -
map や select などのメソッドの遅延評価版を提供するためのクラス。
map や select などのメソッドの遅延評価版を提供するためのクラス。
動作は通常の Enumerator と同じですが、以下のメソッドが遅延評価を行う
(つまり、配列ではなく Enumerator を返す) ように再定義されています。
* map/collect
* flat_map/collect_concat
* select/find_all
* reject
* grep
* take, take_while
* drop, drop_while
* slice_before, slice_after, slice_when
* chunk
* zip ... -
FileUtils (18019.0)
-
基本的なファイル操作を集めたモジュールです。
基本的なファイル操作を集めたモジュールです。
===[a:options] オプションの説明
引数 options で使用できるオプションの説明です。
メソッドごとに使用できるオプションは決まっています。
不正なオプションを与えると ArgumentError が発生します。
: :noop
真を指定すると実際の処理は行いません。
: :preserve
真を指定すると更新時刻と、可能なら所有ユーザ・所有グループもコピーします。
: :verbose
真を指定すると詳細を出力します。
: :mode
パーミッションを8進数で指定します。
: :force
真を指定す... -
rubygems
/ commands / uninstall _ command (18019.0) -
Gem パッケージをアンインストールするためのライブラリです。
Gem パッケージをアンインストールするためのライブラリです。
Usage: gem uninstall GEMNAME [GEMNAME ...] [options]
Options:
-a, --[no-]all Uninstall all matching versions
-I, --[no-]ignore-dependencies Ignore dependency requirements while
uninstalling
-x, --... -
FileUtils
. # remove _ dir(path , force = false) -> () (9622.0) -
ディレクトリ path を削除します。
ディレクトリ path を削除します。
@param path 削除するディレクトリ。
@param force 真のときは削除中に発生した StandardError を無視します。 -
FileUtils
. # remove _ entry(path , force = false) -> () (9622.0) -
ファイル path を削除します。path がディレクトリなら再帰的に削除します。
ファイル path を削除します。path がディレクトリなら再帰的に削除します。
このメソッドにはローカル脆弱性が存在します。
詳しくは FileUtils.#remove_entry_secure の項を参照してください。
@param path 削除するパス。
@param force 真のときは削除中に発生した StandardError を無視します。
//emlist[][ruby]{
require 'fileutils'
FileUtils.remove_entry '/tmp/ruby.tmp.08883'
//}
@see FileUtils.#remove_e... -
FileUtils
. # remove _ entry _ secure(path , force = false) -> () (9622.0) -
ファイル path を削除します。path がディレクトリなら再帰的に削除します。
ファイル path を削除します。path がディレクトリなら再帰的に削除します。
FileUtils.#rm_r および FileUtils.#remove_entry には
TOCTTOU (time-of-check to time-of-use)脆弱性が存在します。
このメソッドはそれを防ぐために新設されました。
FileUtils.#rm_r および FileUtils.#remove_entry は以下の条件が
満たされるときにはセキュリティホールになりえます。
* 親ディレクトリが全ユーザから書き込み可能 (/tmp を含む)
* path 以下のいずれかのディレク... -
FileUtils
. # rm _ f(list , options = {}) -> () (9367.0) -
FileUtils.rm(list, force: true) と同じです。
FileUtils.rm(list, force: true) と同じです。
c:FileUtils#options
@param list 削除する対象。一つの場合は文字列も指定可能です。
二つ以上指定する場合は配列で指定します。
@param options :noop, :verbose が指定できます。
:force がセットされた場合は作業中すべての StandardError を無視します。
@see FileUtils.#rm -
Enumerator
:: Lazy . new(obj , size=nil) {|yielder , *values| . . . } -> Enumerator :: Lazy (9349.0) -
Lazy Enumerator を作成します。Enumerator::Lazy#force メソッドなどに よって列挙が実行されたとき、objのeachメソッドが実行され、値が一つずつ ブロックに渡されます。ブロックは、yielder を使って最終的に yield される値を 指定できます。
Lazy Enumerator を作成します。Enumerator::Lazy#force メソッドなどに
よって列挙が実行されたとき、objのeachメソッドが実行され、値が一つずつ
ブロックに渡されます。ブロックは、yielder を使って最終的に yield される値を
指定できます。
//emlist[Enumerable#filter_map と、その遅延評価版を定義する例][ruby]{
module Enumerable
def filter_map(&block)
map(&block).compact
end
end
class Enumerator::... -
FileUtils
. # remove(list , options = {}) -> () (9337.0) -
list で指定された対象を消去します。
list で指定された対象を消去します。
@param list 削除する対象。一つの場合は文字列も指定可能です。
二つ以上指定する場合は配列で指定します。
@param options :force, :noop, :verbose が指定できます。
c:FileUtils#options
//emlist[][ruby]{
require 'fileutils'
FileUtils.rm('junk.txt')
FileUtils.rm(Dir.glob('*~'))
FileUtils.rm('NotExistFile', f... -
FileUtils
. # rm(list , options = {}) -> () (9337.0) -
list で指定された対象を消去します。
list で指定された対象を消去します。
@param list 削除する対象。一つの場合は文字列も指定可能です。
二つ以上指定する場合は配列で指定します。
@param options :force, :noop, :verbose が指定できます。
c:FileUtils#options
//emlist[][ruby]{
require 'fileutils'
FileUtils.rm('junk.txt')
FileUtils.rm(Dir.glob('*~'))
FileUtils.rm('NotExistFile', f... -
Enumerator
:: Lazy # chunk {|elt| . . . } -> Enumerator :: Lazy (9319.0) -
Enumerable#chunk と同じですが、配列ではなく Enumerator::Lazy を返します。
Enumerable#chunk と同じですが、配列ではなく Enumerator::Lazy を返します。
//emlist[例][ruby]{
1.step.lazy.chunk{ |n| n % 3 == 0 }
# => #<Enumerator::Lazy: #<Enumerator: #<Enumerator::Generator:0x007f8bf18118f0>:each>>
1.step.lazy.chunk{ |n| n % 3 == 0 }.take(5).force
# => [[false, [1, 2]], [true, [3]], [false, [4, 5... -
Enumerator
:: Lazy # chunk(initial _ state) {|elt , state| . . . } -> Enumerator :: Lazy (9319.0) -
Enumerable#chunk と同じですが、配列ではなく Enumerator::Lazy を返します。
Enumerable#chunk と同じですが、配列ではなく Enumerator::Lazy を返します。
//emlist[例][ruby]{
1.step.lazy.chunk{ |n| n % 3 == 0 }
# => #<Enumerator::Lazy: #<Enumerator: #<Enumerator::Generator:0x007f8bf18118f0>:each>>
1.step.lazy.chunk{ |n| n % 3 == 0 }.take(5).force
# => [[false, [1, 2]], [true, [3]], [false, [4, 5... -
Enumerator
:: Lazy # drop(n) -> Enumerator :: Lazy (9319.0) -
Enumerable#drop と同じですが、配列ではなくEnumerator::Lazy を返します。
Enumerable#drop と同じですが、配列ではなくEnumerator::Lazy を返します。
@param n 要素数を指定します。
@raise ArgumentError n に負の数を指定した場合に発生します。
//emlist[例][ruby]{
1.step.lazy.drop(3)
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: 1:step>>:drop(3)>
1.step.lazy.drop(3).take(10).force
# => [4, 5, 6, 7, 8, 9, 10, 1... -
Enumerator
:: Lazy # grep(pattern) {|item| . . . } -> Enumerator :: Lazy (9319.0) -
Enumerable#grep と同じですが、配列ではなくEnumerator::Lazy を返します。
Enumerable#grep と同じですが、配列ではなくEnumerator::Lazy を返します。
//emlist[例][ruby]{
(100..Float::INFINITY).lazy.map(&:to_s).grep(/\A(\d)\1+\z/)
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator::Lazy: 100..Infinity>:map>:grep(/\A(\d)\1+\z/)>
(100..Float::INFINITY).lazy.map(&:to_s).grep(/\A(\d)\1+\z/).... -
Enumerator
:: Lazy # map {|item| . . . } -> Enumerator :: Lazy (9319.0) -
Enumerable#map と同じですが、配列ではなくEnumerator::Lazy を返します。
Enumerable#map と同じですが、配列ではなくEnumerator::Lazy を返します。
@raise ArgumentError ブロックを指定しなかった場合に発生します。
//emlist[例][ruby]{
1.step.lazy.map{ |n| n % 3 == 0 }
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: 1:step>>:map>
1.step.lazy.collect{ |n| n.succ }.take(10).force
# => [2, 3, 4, 5, 6, 7, 8,... -
Enumerator
:: Lazy # reject {|item| . . . } -> Enumerator :: Lazy (9319.0) -
Enumerable#reject と同じですが、配列ではなくEnumerator::Lazy を返します。
Enumerable#reject と同じですが、配列ではなくEnumerator::Lazy を返します。
@raise ArgumentError ブロックを指定しなかった場合に発生します。
//emlist[例][ruby]{
1.step.lazy.reject { |i| i.even? }
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: 1:step>>:reject>
1.step.lazy.reject { |i| i.even? }.take(10).force
# => [1, 3, 5, 7, ... -
Enumerator
:: Lazy # take(n) -> Enumerator :: Lazy (9319.0) -
Enumerable#take と同じですが、配列ではなくEnumerator::Lazy を返します。
Enumerable#take と同じですが、配列ではなくEnumerator::Lazy を返します。
n が大きな数 (100000とか) の場合に備えて再定義されています。
配列が必要な場合は Enumerable#first を使って下さい。
@param n 要素数を指定します。
@raise ArgumentError n に負の数を指定した場合に発生します。
//emlist[例][ruby]{
1.step.lazy.take(5)
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: 1:step>>:... -
Enumerator
:: Lazy # zip(*lists) -> Enumerator :: Lazy (9319.0) -
Enumerable#zip と同じですが、配列ではなくEnumerator::Lazy を返します。
Enumerable#zip と同じですが、配列ではなくEnumerator::Lazy を返します。
ただし一貫性のため、ブロック付きで呼び出した場合は Enumerable#zip と
同じ挙動になります。
//emlist[例][ruby]{
1.step.lazy.zip(('a'..'z').cycle)
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: 1:step>>:zip(#<Enumerator: "a".."z":cycle>)>
1.step.lazy.zip(('a'..'z').cycle)... -
Enumerator
:: Lazy # zip(*lists) {|v1 , v2 , . . . | . . . } -> nil (9319.0) -
Enumerable#zip と同じですが、配列ではなくEnumerator::Lazy を返します。
Enumerable#zip と同じですが、配列ではなくEnumerator::Lazy を返します。
ただし一貫性のため、ブロック付きで呼び出した場合は Enumerable#zip と
同じ挙動になります。
//emlist[例][ruby]{
1.step.lazy.zip(('a'..'z').cycle)
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: 1:step>>:zip(#<Enumerator: "a".."z":cycle>)>
1.step.lazy.zip(('a'..'z').cycle)... -
FileUtils
. # rm _ r(list , options = {}) -> () (9319.0) -
ファイルまたはディレクトリ list を再帰的に消去します。
ファイルまたはディレクトリ list を再帰的に消去します。
@param list 削除する対象。一つの場合は文字列も指定可能です。
二つ以上指定する場合は配列で指定します。
@param options :force, :noop, :verbose, :secure が指定できます。
c:FileUtils#options
=== 注意
このメソッドにはローカル脆弱性が存在します。
この脆弱性を回避するには :secure オプションを使用してください。
詳しくは FileUtils.#remove_entry_secure... -
FileUtils
. # rm _ rf(list , options = {}) -> () (9319.0) -
ファイルまたはディレクトリ list を再帰的に消去します。
ファイルまたはディレクトリ list を再帰的に消去します。
rm_r(list, force: true) と同じです。
@param list 削除する対象。一つの場合は文字列も指定可能です。
二つ以上指定する場合は配列で指定します。
@param options :noop, :verbose, :secure が指定できます。
c:FileUtils#options
=== 注意
このメソッドにはローカル脆弱性が存在します。
この脆弱性を回避するには :secure オプションを使用してください。
詳しくは FileUt... -
FileUtils
. # rmtree(list , options = {}) -> () (9319.0) -
ファイルまたはディレクトリ list を再帰的に消去します。
ファイルまたはディレクトリ list を再帰的に消去します。
rm_r(list, force: true) と同じです。
@param list 削除する対象。一つの場合は文字列も指定可能です。
二つ以上指定する場合は配列で指定します。
@param options :noop, :verbose, :secure が指定できます。
c:FileUtils#options
=== 注意
このメソッドにはローカル脆弱性が存在します。
この脆弱性を回避するには :secure オプションを使用してください。
詳しくは FileUt... -
Gem
:: DependencyInstaller . new(options = {}) -> Gem :: DependencyInstaller (9319.0) -
自身を初期化します。
自身を初期化します。
オプションとして以下のものを利用できます。
: :cache_dir
*.gem ファイルを保存するディレクトリを指定します。
: :domain
:local (カレントディレクトリのみ検索します), :remote (Gem.sources を検索します),
:both (:local, :remote の両方を検索します) のいずれかを指定可能です。
: :env_shebang
Gem::Installer.new を参照してください。
: :force
バージョンチェックとセキュリティポリシーのチェックを行わずにインストールを実行します... -
Gem
:: Installer . new(gem , options = {}) -> Gem :: Installer (9319.0) -
@todo 書いてないオプションがいっぱいある
@todo 書いてないオプションがいっぱいある
与えられた引数で自身を初期化します。
@param gem インストール対象の Gem のパスを指定します。
@param options インストーラが使用するオプションをハッシュで指定します。
使用できるキーは以下の通りです。
: :env_shebang
コマンドのラッパーで shebang line に /usr/bin/env を使用します。
: :force
署名された Gem のみをインストールするというポリシー以外、
全てのバージョンチェックとセキュリティポリシーのチェックを行わない... -
FileUtils
. # move(src , dest , options = {}) -> () (9037.0) -
ファイル src を dest に移動します。
ファイル src を dest に移動します。
src が一つの場合、
dest がすでに存在しディレクトリであるときは src を dest/src へ移動します。
dest がすでに存在しディレクトリでないときは src は dest を上書きします。
src が複数の場合、
src[0] を dest/src[0]、src[1] を dest/src[1] へ移動します。
dest がディレクトリでない場合は例外 Errno::ENOTDIR が発生します。
@param src 元のファイル。一つの場合は文字列でも指定可能です。
二つ以上指定する場合は配列... -
FileUtils
. # mv(src , dest , options = {}) -> () (9037.0) -
ファイル src を dest に移動します。
ファイル src を dest に移動します。
src が一つの場合、
dest がすでに存在しディレクトリであるときは src を dest/src へ移動します。
dest がすでに存在しディレクトリでないときは src は dest を上書きします。
src が複数の場合、
src[0] を dest/src[0]、src[1] を dest/src[1] へ移動します。
dest がディレクトリでない場合は例外 Errno::ENOTDIR が発生します。
@param src 元のファイル。一つの場合は文字列でも指定可能です。
二つ以上指定する場合は配列... -
FileUtils
. # cp _ r(src , dest , options = {}) -> () (9019.0) -
src を dest にコピーします。src がディレクトリであったら再帰的に コピーします。その際 dest がディレクトリなら dest/src にコピーします。
src を dest にコピーします。src がディレクトリであったら再帰的に
コピーします。その際 dest がディレクトリなら dest/src にコピーします。
@param src コピー元。一つの場合は文字列でも指定可能です。
二つ以上指定する場合は配列で指定します。
@param dest コピー先のファイルかディレクトリです。
@param options :preserve, :noop, :verbose, :dereference_root, :remove_destination が指定できます。
c:FileU... -
FileUtils
. options -> Array (9019.0) -
オプション名の配列を返します。
オプション名の配列を返します。
//emlist[][ruby]{
require 'fileutils'
FileUtils.options
# => ["verbose", "mode", "noop", "parents", "force", "preserve", "dereference_root", "remove_destination", "secure", "mtime", "nocreate"]
//} -
FileUtils
. options _ of(mid) -> Array (9019.0) -
与えられたメソッド名で使用可能なオプション名の配列を返します。
与えられたメソッド名で使用可能なオプション名の配列を返します。
@param mid メソッド名を指定します。
//emlist[][ruby]{
require 'fileutils'
FileUtils.options_of(:rm) # => ["noop", "verbose", "force"]
//} -
Regexp
# fixed _ encoding? -> bool (409.0) -
正規表現が任意の ASCII 互換エンコーディングとマッチ可能な時に false を返します。
正規表現が任意の ASCII 互換エンコーディングとマッチ可能な時に false を返します。
//emlist[例][ruby]{
# -*- coding:utf-8 -*-
r = /a/
r.fixed_encoding? # => false
r.encoding # => #<Encoding:US-ASCII>
r =~ "\u{6666} a" # => 2
r =~ "\xa1\... -
Encoding
:: Converter # insert _ output(string) -> nil (337.0) -
変換器内のバッファに文字列を挿入します。 バッファに保持された文字列は、次の変換時の変換結果と一緒に返されます。
変換器内のバッファに文字列を挿入します。
バッファに保持された文字列は、次の変換時の変換結果と一緒に返されます。
変換先がステートフルなエンコーディングであった場合、
挿入された文字列は状態に基づいて変換され、状態を更新します。
このメソッドは変換に際してエラーが発生した際にのみ利用されるべきです。
@param string 挿入する文字列
//emlist[][ruby]{
ec = Encoding::Converter.new("utf-8", "iso-8859-1")
src = "HIRAGANA LETTER A is \u{3042}."
dst = ""
p ec.... -
Kconv
. # isjis(str) -> bool (337.0) -
文字列 str が ISO-2022-JP なバイト列として正当であるかどうかを判定します。
文字列 str が ISO-2022-JP なバイト列として正当であるかどうかを判定します。
@param str 判定対象の文字列
@see String#isjis
//emlist[例][ruby]{
require 'kconv'
euc_str = "\
\xa5\xaa\xa5\xd6\xa5\xb8\xa5\xa7\xa5\xaf\xa5\xc8\xbb\xd8\xb8\xfe\
\xa5\xd7\xa5\xed\xa5\xb0\xa5\xe9\xa5\xdf\xa5\xf3\xa5\xb0\xb8\xc0\xb8\xec\
\x52\x75\x62\x79".force_... -
String
# iseuc -> bool (337.0) -
self が EUC-JP なバイト列として正当であるかどうかを判定します。
self が EUC-JP なバイト列として正当であるかどうかを判定します。
Kconv.#iseuc(self) と同じです。
//emlist[例][ruby]{
require 'kconv'
euc_str = "\
\xa5\xaa\xa5\xd6\xa5\xb8\xa5\xa7\xa5\xaf\xa5\xc8\xbb\xd8\xb8\xfe\
\xa5\xd7\xa5\xed\xa5\xb0\xa5\xe9\xa5\xdf\xa5\xf3\xa5\xb0\xb8\xc0\xb8\xec\
\x52\x75\x62\x79".force_encoding('EUC-JP')
... -
Encoding
:: Converter # primitive _ convert(source _ buffer , destination _ buffer) -> Symbol (319.0) -
エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。
エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。
可搬性を確保しつつ、不正なバイトや変換先で未定義な文字の扱いを細かに指定したいときは、Encoding::Converter#primitive_convert が唯一の方法になります。
@param source_buffer 変換元文字列のバッファ
@param destination_buffer 変換先文字列を格納するバッファ
@param destination_byteoffset 変換先バッファでのオフセット
@param destination_bytesize 変換先バッファの容量
@... -
Encoding
:: Converter # primitive _ convert(source _ buffer , destination _ buffer , destination _ byteoffset) -> Symbol (319.0) -
エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。
エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。
可搬性を確保しつつ、不正なバイトや変換先で未定義な文字の扱いを細かに指定したいときは、Encoding::Converter#primitive_convert が唯一の方法になります。
@param source_buffer 変換元文字列のバッファ
@param destination_buffer 変換先文字列を格納するバッファ
@param destination_byteoffset 変換先バッファでのオフセット
@param destination_bytesize 変換先バッファの容量
@... -
Encoding
:: Converter # primitive _ convert(source _ buffer , destination _ buffer , destination _ byteoffset , destination _ bytesize) -> Symbol (319.0) -
エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。
エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。
可搬性を確保しつつ、不正なバイトや変換先で未定義な文字の扱いを細かに指定したいときは、Encoding::Converter#primitive_convert が唯一の方法になります。
@param source_buffer 変換元文字列のバッファ
@param destination_buffer 変換先文字列を格納するバッファ
@param destination_byteoffset 変換先バッファでのオフセット
@param destination_bytesize 変換先バッファの容量
@... -
Encoding
:: Converter # primitive _ convert(source _ buffer , destination _ buffer , destination _ byteoffset , destination _ bytesize , options) -> Symbol (319.0) -
エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。
エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。
可搬性を確保しつつ、不正なバイトや変換先で未定義な文字の扱いを細かに指定したいときは、Encoding::Converter#primitive_convert が唯一の方法になります。
@param source_buffer 変換元文字列のバッファ
@param destination_buffer 変換先文字列を格納するバッファ
@param destination_byteoffset 変換先バッファでのオフセット
@param destination_bytesize 変換先バッファの容量
@... -
Rake
:: PackageTask . new(name = nil , version = nil) {|t| . . . } -> Rake :: PackageTask (319.0) -
自身を初期化してタスクを定義します。
自身を初期化してタスクを定義します。
ブロックが与えられた場合は、自身をブロックパラメータとして
ブロックを評価します。
@param name パッケージ名を指定します。
@param version パッケージのバージョンを指定します。
':noversion' というシンボルを指定するとバージョン情報をセットしません。
//emlist[][ruby]{
# Rakefile での記載例とする
require 'rake/packagetask'
Rake::PackageTask.new("sample", "1.0.0") do |packa... -
ruby 1
. 8 . 2 feature (55.0) -
ruby 1.8.2 feature ruby 1.8.2 での ruby 1.8.1 からの変更点です。
ruby 1.8.2 feature
ruby 1.8.2 での ruby 1.8.1 からの変更点です。
掲載方針
*バグ修正の影響も含めて動作が変わるものを収録する。
*単にバグを直しただけのものは収録しない。
*ライブラリへの単なる定数の追加は収録しない。
以下は各変更点に付けるべきタグです。
*カテゴリ
* [ruby]: ruby インタプリタの変更
* [api]: 拡張ライブラリ API
* [lib]: ライブラリ
*レベル
* [bug]: バグ修正
* [new]: 追加されたクラス/メソッドなど
* [compat]: 変更されたクラス/...