176件ヒット
[1-100件を表示]
(0.032秒)
別のキーワード
クラス
- BasicObject (33)
-
File
:: Stat (22) - IO (22)
- Module (22)
- String (77)
キーワード
- []= (77)
-
class
_ exec (11) -
close
_ on _ exec= (11) -
close
_ on _ exec? (11) - executable? (11)
-
executable
_ real? (11) -
instance
_ eval (22) -
instance
_ exec (11) -
module
_ exec (11)
検索結果
先頭5件
-
IO
# close _ on _ exec? -> bool (6156.0) -
自身に close-on-exec フラグが設定されていた場合 true を返します。 そうでない場合に false を返します。
...close-on-exec フラグが設定されていた場合 true を返します。
そうでない場合に false を返します。
f = open("/dev/null")
f.close_on_exec? #=> true
f.close_on_exec = false
f.close_on_exec? #=> false
f.close_on_exec = true......f.close_on_exec? #=> true
@see IO#close_on_exec=... -
IO
# close _ on _ exec=(bool) (6144.0) -
自身に close-on-exec フラグを設定します。
...-on-exec フラグを設定します。
このフラグをセットすると exec(2) 時にそのファイルデスクリプタを
close します。
@see fcntl(2)
@param bool 自身の close-on-exec フラグを true か false で指定します。
f = open("/dev/null")
f.close_on_exec = t......rue
system("cat", "/proc/self/fd/#{f.fileno}") # cat: /proc/self/fd/3: No such file or directory
f.closed? #=> false
@see IO#close_on_exec?... -
BasicObject
# instance _ exec(*args) {|*vars| . . . } -> object (6122.0) -
与えられたブロックをレシーバのコンテキストで実行します。
...タに渡す値です。
//emlist[例][ruby]{
class KlassWithSecret
def initialize
@secret = 99
end
end
k = KlassWithSecret.new
# 以下で x には 5 が渡される
k.instance_exec(5) {|x| @secret + x } #=> 104
//}
@see Module#class_exec, Module#module_exec, BasicObject#instance_eval... -
Module
# class _ exec(*args) {|*vars| . . . } -> object (6111.0) -
与えられたブロックを指定された args を引数としてモジュールのコンテキストで評価します。
...コープになります。
@param args ブロックに渡す引数を指定します。
//emlist[例][ruby]{
class Thing
end
c = 1
Thing.class_exec{
def hello()
"Hello there!"
end
define_method(:foo) do # ローカル変数がブロックの外側を参照している
c
end... -
Module
# module _ exec(*args) {|*vars| . . . } -> object (6111.0) -
与えられたブロックを指定された args を引数としてモジュールのコンテキストで評価します。
...コープになります。
@param args ブロックに渡す引数を指定します。
//emlist[例][ruby]{
class Thing
end
c = 1
Thing.class_exec{
def hello()
"Hello there!"
end
define_method(:foo) do # ローカル変数がブロックの外側を参照している
c
end... -
File
:: Stat # executable? -> bool (6103.0) -
実効ユーザ/グループIDで実行できる時に真を返します。
...実効ユーザ/グループIDで実行できる時に真を返します。
//emlist[][ruby]{
p File::Stat.new($0).executable?
# 例
#=> true
//}... -
File
:: Stat # executable _ real? -> bool (6103.0) -
実ユーザ/グループIDで実行できる時に真を返します。
...実ユーザ/グループIDで実行できる時に真を返します。
//emlist[][ruby]{
p File::Stat.new($0).executable_real?
#例
#=> true
//}... -
BasicObject
# instance _ eval {|obj| . . . } -> object (9.0) -
オブジェクトのコンテキストで文字列 expr またはオブジェクト自身をブロックパラメータとするブロックを 評価してその結果を返します。
...imeError)
//}
//emlist[例][ruby]{
class Bar < BasicObject
def call1
instance_eval("::ENV.class")
end
def call2
instance_eval("ENV.class")
end
end
bar = Bar.new
bar.call1 # => Object
bar.call2 # raise NameError
//}
@see Module#module_eval, Kernel.#eval, BasicObject#instance_exec... -
BasicObject
# instance _ eval(expr , filename = "(eval)" , lineno = 1) -> object (9.0) -
オブジェクトのコンテキストで文字列 expr またはオブジェクト自身をブロックパラメータとするブロックを 評価してその結果を返します。
...imeError)
//}
//emlist[例][ruby]{
class Bar < BasicObject
def call1
instance_eval("::ENV.class")
end
def call2
instance_eval("ENV.class")
end
end
bar = Bar.new
bar.call1 # => Object
bar.call2 # raise NameError
//}
@see Module#module_eval, Kernel.#eval, BasicObject#instance_exec... -
String
# []=(regexp , nth , val) (9.0) -
正規表現 regexp の nth 番目の括弧にマッチする 最初の部分文字列を文字列 val で置き換えます。
...定範囲の部分文字列と置き換えたい文字列
@return val を返します。
@raise IndexError 正規表現がマッチしなかった場合に発生します。
//emlist[例][ruby]{
buf = "def exec(cmd)"
buf[/def\s+(\w+)/, 1] = "preprocess"
p buf # => "def preprocess(cmd)"
//}...