種類
- インスタンスメソッド (96)
- 文書 (55)
- 特異メソッド (54)
- ライブラリ (12)
ライブラリ
- ビルトイン (36)
- shell (54)
-
shell
/ command-processor (24) -
shell
/ filter (24) -
shell
/ system-command (12)
クラス
- Dir (24)
- Shell (54)
-
Shell
:: CommandProcessor (24) -
Shell
:: Filter (24) -
Shell
:: SystemCommand (12) - String (12)
キーワード
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (12) -
NEWS for Ruby 2
. 0 . 0 (12) -
NEWS for Ruby 2
. 6 . 0 (7) - Rubyで使われる記号の意味(正規表現の複雑な記号は除く) (12)
-
alias
_ command (6) - cat (18)
-
def
_ system _ command (6) - echo (18)
- foreach (24)
- glob (18)
-
install
_ system _ commands (6) -
ruby 1
. 8 . 4 feature (12) - sum (12)
-
super
_ each (6) - tee (18)
- tsort (12)
-
unalias
_ command (6) -
undef
_ system _ command (6)
検索結果
先頭5件
- Shell
:: SystemCommand # each(rs = nil) {|line| . . . } - Shell
:: SystemCommand # super _ each -> () - Dir
. foreach(path , encoding: Encoding . find("filesystem")) -> Enumerator - Dir
. foreach(path , encoding: Encoding . find("filesystem")) {|file| . . . } -> nil - Dir
. foreach(path , encoding: Encoding . find("filesystem")) -> Enumerator
-
Shell
:: SystemCommand # each(rs = nil) {|line| . . . } (21101.0) -
@todo
@todo
@param rs -
Shell
:: SystemCommand # super _ each -> () (9107.0) -
@todo
...@todo
Shell::Filter#each です。... -
Dir
. foreach(path , encoding: Encoding . find("filesystem")) -> Enumerator (6206.0) -
ディレクトリ path の各エントリを表す文字列を引数として、ブロックを評価します。
...た場合は
ファイルシステムのエンコーディングと同じになります。
@raise Errno::EXXX 失敗した場合に発生します。
//emlist[例][ruby]{
Dir.foreach('.'){|f|
p f
}
#=> "."
# ".."
# "bar"
# "foo"
//}
@see Dir.entries
@see Dir.each_child... -
Dir
. foreach(path , encoding: Encoding . find("filesystem")) {|file| . . . } -> nil (6206.0) -
ディレクトリ path の各エントリを表す文字列を引数として、ブロックを評価します。
...た場合は
ファイルシステムのエンコーディングと同じになります。
@raise Errno::EXXX 失敗した場合に発生します。
//emlist[例][ruby]{
Dir.foreach('.'){|f|
p f
}
#=> "."
# ".."
# "bar"
# "foo"
//}
@see Dir.entries
@see Dir.each_child... -
Dir
. foreach(path , encoding: Encoding . find("filesystem")) -> Enumerator (6200.0) -
ディレクトリ path の各エントリを表す文字列を引数として、ブロックを評価します。
...します。省略した場合は
ファイルシステムのエンコーディングと同じになります。
@raise Errno::EXXX 失敗した場合に発生します。
//emlist[例][ruby]{
Dir.foreach('.'){|f|
p f
}
#=> "."
# ".."
# "bar"
# "foo"
//}
@see Dir.entries... -
Dir
. foreach(path , encoding: Encoding . find("filesystem")) {|file| . . . } -> nil (6200.0) -
ディレクトリ path の各エントリを表す文字列を引数として、ブロックを評価します。
...します。省略した場合は
ファイルシステムのエンコーディングと同じになります。
@raise Errno::EXXX 失敗した場合に発生します。
//emlist[例][ruby]{
Dir.foreach('.'){|f|
p f
}
#=> "."
# ".."
# "bar"
# "foo"
//}
@see Dir.entries... -
Shell
. def _ system _ command(command , path = command) -> nil (6131.0) -
Shell のメソッドとして command を登録します.
...ドを実行するにはまず, Shellのメソッドとして定義します.
注) コマンドを定義しなくとも直接実行できる Shell#system コマンドもあります.
@param command Shell のメソッドとして定義するコマンドを文字列で指定します。
@param path......require 'shell'
Shell.def_system_command "ls"
# ls を定義
Shell.def_system_command "sys_sort", "sort"
# sortコマンドをsys_sortとして定義
sh = Shell.new
sh.transact {
ls.each { |l|
puts l
}
(ls("-l") | sys_sort("-k 5")).each {|l|
puts l
}
}... -
Shell
. install _ system _ commands(pre = "sys _ ") -> () (6129.0) -
system_path上にある全ての実行可能ファイルをShellに定義する. メソッ ド名は元のファイル名の頭にpreをつけたものとなる.
...
system_path上にある全ての実行可能ファイルをShellに定義する. メソッ
ド名は元のファイル名の頭にpreをつけたものとなる.
@param pre Shellに定義するメソッド名の先頭に付加される文字列を指定します。
使用例: ls -l | head -n 5......のような例。
require 'shell'
Shell.install_system_commands
sh = Shell.new
sh.verbose = false
sh.transact {
(sys_ls("-l") | sys_head("-n 5")).each {|l|
puts l
}
}... -
Shell
. undef _ system _ command(command) -> Shell :: CommandProcessor (6119.0) -
commandを削除します.
...字列を指定します。
動作例:
require 'shell'
Shell.def_system_command("ls")
# ls を定義
Shell.undef_system_command("ls")
# ls を 削除
sh = Shell.new
begin
sh.transact {
ls("-l").each {|l|
puts l
}
}
rescue NameError => err
puts err... -
NEWS for Ruby 2
. 0 . 0 (72.0) -
NEWS for Ruby 2.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...ない変数は警告しなくなりました
=== 組み込みクラスの更新
* ARGF.class
* 追加: ARGF.class#codepoints, ARGF.class#each_codepoint
IO にある同名のメソッドに対応します
* Array
* 追加: Array#bsearch 二分探索します
* 非互換:......: Object#to_enum Object#enum_for サイズの遅延評価のためにブロックを受け取るようになりました
* 非互換: Kernel.#system, Kernel.#exec は非標準のファイルディスクリプタを閉じます
:close_others オプションのデフォルト値を true に......t{
str.lines.with_index(1) {|line, lineno| ... } # str.lines が配列を返すのでもう動かない
str.each_line.with_index(1) {|line, lineno| ... } # このように each_line に置き換える
//}
* IO#lines, IO#chars, IO#codepoints, IO#bytes, ARGF#lines, ARGF#chars,
ARGF#byte... -
tsort (54.0)
-
tsort はトポロジカルソートと強連結成分に関するモジュールを提供します。
...を提供します。
=== Example
//emlist[][ruby]{
require 'tsort'
class Hash
include TSort
alias tsort_each_node each_key
def tsort_each_child(node, &block)
fetch(node).each(&block)
end
end
{1=>[2, 3], 2=>[3], 3=>[], 4=>[]}.tsort
#=> [3, 2, 1, 4]
{1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}......ult = []
end
def rule(outputs, inputs=[], &block)
triple = [outputs, inputs, block]
outputs.each {|f| @dep[f] = [triple]}
@dep[triple] = inputs
end
def build(target)
each_strongly_connected_component_from(target) {|ns|
if ns.length != 1
fs = ns.delete_if {|n|......o_i == Time.now.to_i
block.call
end
end
}
end
def tsort_each_child(node, &block)
@dep[node].each(&block)
end
include TSort
end
def command(arg)
print arg, "\n"
system arg
end
m = Make.new
m.rule(%w[t1]) { command 'date > t1' }
m.rule(%w[t2]) { command '... -
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (36.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への変更点(まとめ)/サポートプラットフォームの追加>))
..., Method オブジェクト限定でした。
これに伴い Proc#to_proc が追加されました。
: 終了ステータス [compat]
raise SystemExit したときに終了ステータス 1 で終了するようになりました。
((<ruby-dev:16776>))
: ((<"rescue/ensure on begin .. end......って比較するようになりました。
以前は kind_of? による比較なので基本的な動作に変わりはありませんが、
SystemCallError.=== は特別に errno が一致する例外を同じと見なすよう
に再定義されました。これにより、例えば Err......uct/each_pair>)) [new]
追加。
=== Symbol
: ((<Symbol/Symbol.all_symbols>)) [new]
追加 ((<ruby-dev:12921>))
=== SystemCallError
: ((<SystemCallError/SystemCallError.===>)) [new]
追加 (上記 「rescue 節の...」 を参照のこと)
((<ruby-dev:12670>))
: ((<SystemExit... -
NEWS for Ruby 2
. 6 . 0 (36.0) -
NEWS for Ruby 2.6.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...ist{
ary[1..] # ary[1..-1] と同じ
(1...).each {|index| block } # index が 1 から始まる無限ループ
ary.zip(1..) {|elem, index| block } # ary.each.with_index(1) { }
//}
* キーワード引数のハッシュに Symbol 以外の......め 4352、
この新しいメソッドを用いることが今後は推奨されます。
* Dir
* 新規メソッド
* Dir#each_child と Dir#children 追加 13969
* Enumerable
* 新規メソッド
* Enumerable#chain はレシーバと引数のそれぞれの要......ションが
追加されました。 12732
* Kernel.#system に失敗時に例外を発生する :exception オプションが
追加されました。 14386
* 非互換な変更
* Kernel.#system と Kernel.#exec が非標準にファイルディスクリプタを閉... -
Rubyで使われる記号の意味(正規表現の複雑な記号は除く) (36.0)
-
Rubyで使われる記号の意味(正規表現の複雑な記号は除く) ex q num per and or plus minus ast slash hat sq period comma langl rangl eq tilde dollar at under lbrarbra lbra2rbra2 lbra3rbra3 dq colon ac backslash semicolon
...ント。d:spec/m17n#magic_comment を参照。
: "a is #{a}"
d:spec/literal#exp
//emlist{
a = 10
p "a is #{a}" #=> "a is 10"
//}
: Range#each
説明文の中でのみ使われます。Ruby言語の要素ではありません。クラスのインスタンスメソッドであることを......"nomad"
//}
: % ruby -e "puts 'Hello'"
コマンドラインへの入力を示す。rubyスクリプト上で入力を行うには `command` や system(command) などと書く
===[a:and] &
: xxx & yyy
論理積演算子。または類似の演算を行うメソッド。
//emlist{
p( 3 &......ソッド/モジュールの
モジュールメソッドを示すことに使われます。一方、インスタンスメソッドは「Range#each」のように
「#」でつなぎます。
: 1 .. 20
最大値を含む Range オブジェクトを作る範囲演算子です。全体で範囲...