るりまサーチ

最速Rubyリファレンスマニュアル検索!
356件ヒット [1-100件を表示] (0.082秒)
トップページ > クエリ:-[x] > クエリ:SH[x] > クエリ:|[x] > 種類:特異メソッド[x]

別のキーワード

  1. _builtin -
  2. open-uri open
  3. irb/input-method new
  4. irb/input-method gets
  5. matrix -

ライブラリ

クラス

モジュール

オブジェクト

検索結果

<< 1 2 3 ... > >>

ENV.shift -> [String, String] | nil (6302.0)

環境変数を一つ取り除いて、それを名前と値の組の配列で返します。 環境変数が一つも設定されていなければ nil を返します。

環境変数を一つ取り除いて、それを名前と値の組の配列で返します。
環境変数が一つも設定されていなければ nil を返します。

Hash.new {|hash, key| ... } -> Hash (3414.0)

空の新しいハッシュを生成します。ブロックの評価結果がデフォルト値になりま す。設定したデフォルト値はHash#default_procで参照できます。

...の新しいハッシュを生成します。ブロックの評価結果がデフォルト値になりま
す。設定したデフォルト値はHash#default_procで参照できます。

値が設定されていないハッシュ要素を参照するとその都度ブロックを
実行し、その...
...ルト値は全部同一のオブジェクトなので、
# 破壊的変更によって他のキーに対応する値も変更されます。
h = Hash.new("foo")

p h[1] #=> "foo"
p h[1].object_id #=> 6127170
p h[1] << "bar" #=> "foobar"
p h[1] #=> "f...
...だ無いキーが呼び出される度に
# ブロックを評価するので、全て別のオブジェクトになります。
h = Hash.new {|hash, key| hash[key] = "foo"}

p h[1] #=> "foo"
p h[1].object_id #=> 6126900
p h[1] << "bar" #=> "foobar"
p h[1]...

Hash.try_convert(obj) -> Hash | nil (3302.0)

to_hash メソッドを用いて obj をハッシュに変換しようとします。

...to_hash メソッドを用いて obj をハッシュに変換しようとします。

何らかの理由で変換できないときには nil を返します。
このメソッドは引数がハッシュであるかどうかを調べるために使えます。

//emlist[][ruby]{
Hash.try_convert({...
...1=>2}) # => {1=>2}
Hash.try_convert("1=>2") # => nil
//}...

Shell.undef_system_command(command) -> Shell::CommandProcessor (3219.0)

commandを削除します.

...の文字列を指定します。

動作例:
require 'shell'
Sh
ell.def_system_command("ls")
# ls を定義
Sh
ell.undef_system_command("ls")
# ls を 削除

sh
= Shell.new
begin
sh
.transact {
ls("-l").each {|l|
puts l
}
}
rescue NameError => err
put...

Hash.new(ifnone = nil) -> Hash (3204.0)

空の新しいハッシュを生成します。ifnone はキーに対 応する値が存在しない時のデフォルト値です。設定したデフォルト値はHash#defaultで参照できます。

...none はキーに対
応する値が存在しない時のデフォルト値です。設定したデフォルト値はHash#defaultで参照できます。

ifnoneを省略した Hash.new は {} と同じです。

デフォルト値として、毎回同一のオブジェクトifnoneを返します。...
...それにより、一箇所のデフォルト値の変更が他の値のデフォルト値にも影響します。

//emlist[][ruby]{
h = Hash.new([])
h[0] << 0
h[1] << 1
p h.default #=> [0, 1]
//}

これを避けるには、破壊的でないメソッドで再代入する必要が有ります。...
...][ruby]{
h = Hash.new([])

p h[1] #=> []
p h[1].object_id #=> 6127150
p h[1] << "bar" #=> ["bar"]
p h[1] #=> ["bar"]

p h[2] #=> ["bar"]
p h[2].object_id #=> 6127150

p h #=> {}


h = Hash.new([].freeze)
h[0...

絞り込み条件を変える

Shell.debug -> bool | Integer (3203.0)

@todo

@todo

デバッグ用フラグを参照します。

Shell.debug? -> bool | Integer (3203.0)

@todo

@todo

デバッグ用フラグを参照します。

Shell.debug_output_exclusive_unlock { ... } -> Mutex | nil (3202.0)

@todo

@todo

@see Mutex#exclusive_unlock

Shell.debug_output_unlock -> Mutex | nil (3202.0)

@todo

@todo

@see Mutex#unlock
@todo

@see Thread::Mutex#unlock

Shell.notify(*opts) {|message| ... } -> String (3202.0)

@todo

@todo

絞り込み条件を変える

Shell::ProcessController.each_active_object {|ref| ... } -> () (3202.0)

@todo

@todo

Shell.install_system_commands(pre = "sys_") -> () (3149.0)

system_path上にある全ての実行可能ファイルをShellに定義する. メソッ ド名は元のファイル名の頭にpreをつけたものとなる.

...イルをShellに定義する. メソッ
ド名は元のファイル名の頭にpreをつけたものとなる.

@param pre Shellに定義するメソッド名の先頭に付加される文字列を指定します。

使用例: ls -l | head -n 5 のような例。

require 'shell'
Sh
ell.install...
..._system_commands
sh
= Shell.new
sh
.verbose = false
sh
.transact {
(sys_ls("-l") | sys_head("-n 5")).each {|l|
puts l
}
}...

Shell.alias_command(alias, command, *opts) {...} -> self (3143.0)

コマンドの別名(エイリアス)を作成します。 コマンドが無い場合は、Shell.def_system_command などであらかじめ作成します.

...コマンドの別名(エイリアス)を作成します。
コマンドが無い場合は、Shell.def_system_command などであらかじめ作成します.

@param alias エイリアスの名前を文字列で指定します.

@param command コマンド名を文字列で指定します.

@param...
...を指定します.

使用例: ls -la | sort -k 5 のような例。

require 'shell'
Sh
ell.def_system_command("ls")
Sh
ell.alias_command("lsla", "ls", "-a", "-l")
Sh
ell.def_system_command("sort")
sh
= Shell.new
sh
.transact {
(lsla | sort("-k 5")).each {|l|
puts l
}
}...

Shell.unalias_command(alias) -> () (3143.0)

commandのaliasを削除します.

...使用例: ls -la | sort -k 5 のような例。
require 'shell'
Sh
ell.def_system_command("ls")
Sh
ell.alias_command("lsla", "ls", "-a", "-l")
Sh
ell.def_system_command("sort")
sh
= Shell.new
sh
.transact {
(lsla | sort("-k 5")).each {|l|
puts l
}
}
Sh
ell.unalias_command...
...("lsla")
begin
Sh
ell.unalias_command("lsla")
rescue NameError => err
puts err
end...
<< 1 2 3 ... > >>