るりまサーチ

最速Rubyリファレンスマニュアル検索!
151件ヒット [1-100件を表示] (0.036秒)

別のキーワード

  1. _builtin file?
  2. _builtin file
  3. file path
  4. file truncate
  5. file open

クラス

キーワード

検索結果

<< 1 2 > >>

File#flock(operation) -> 0 | false (9171.0)

ファイルをロックします。

...をロックします。

ロックを取得するまでブロックされます。
ロックの取得に成功した場合は 0 を返します。
File
::LOCK_NB (ノンブロッキング) を指定すると、本来ならブロックされる場合に
ブロックされずに false を返すよう...
...eration に有効な定数は以下の通りです。定数は File::Constants で定義されていますが、
File
クラスの親クラスの IO が File::Constants をインクルードしているので、
これらの定数は File::LOCK_SH などとして参照可能です。

: LOCK_SH
...
...的なアンロック以外に、ファイルのcloseやRubyインタプリタの終了
(プロセスの終了)によっても自動的にロック状態は解除されます。
: LOCK_NB
ノンブロックモード。
File
::LOCK_SH | File::LOCK_NB のように他の指定と or することで...

RubyVM::InstructionSequence#base_label -> String (3027.0)

self が表す命令シーケンスの基本ラベルを返します。

...た場合

iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
# => <RubyVM::InstructionSequence:<compiled>@<compiled>>
iseq.base_label
# => "<compiled>"

例2: RubyVM::InstructionSequence.compile_file を使用した場合

# /tmp/method.rb
def hello
puts
"hello, world"
end...
...# irb
> iseq = RubyVM::InstructionSequence.compile_file('/tmp/method.rb')
> iseq.base_label # => "<main>"

例3:

# /tmp/method2.rb
def hello
puts
"hello, world"
end

Ruby
VM::InstructionSequence.of(method(:hello)).base_label
# => "hello"

@see RubyVM::InstructionSequence#label...

RubyVM::InstructionSequence#label -> String (3027.0)

self が表す命令シーケンスのラベルを返します。通常、メソッド名、クラス名、 モジュール名などで構成されます。

... RubyVM::InstructionSequence.compile('num = 1 + 2')
# => <RubyVM::InstructionSequence:<compiled>@<compiled>>
iseq.label
# => "<compiled>"

例2: RubyVM::InstructionSequence.compile_file を使用した場合

# /tmp/method.rb
def hello
puts
"hello, world"
end

# irb
> iseq = Ruby...
...VM::InstructionSequence.compile_file('/tmp/method.rb')
> iseq.label # => "<main>"

例3:

# /tmp/method2.rb
def hello
puts
"hello, world"
end

Ruby
VM::InstructionSequence.of(method(:hello)).label
# => "hello"

@see RubyVM::InstructionSequence#base_label...

File::Stat#blockdev? -> bool (3021.0)

ブロックスペシャルファイルの時に真を返します。

...ブロックスペシャルファイルの時に真を返します。

//emlist[][ruby]{
Dir.glob("/dev/*") {|bd|
if File::Stat.new(bd).blockdev?
puts
bd
end
}
#例
#...
#=> /dev/hda1
#=> /dev/hda3
#...
//}...

File::Stat#chardev? -> bool (3021.0)

キャラクタスペシャルファイルの時に真を返します。

...キャラクタスペシャルファイルの時に真を返します。

//emlist[][ruby]{
Dir.glob("/dev/*") {|bd|
if File::Stat.new(bd).chardev?
puts
bd
end
}
#例
#...
#=> /dev/tty1
#=> /dev/stderr
#...
//}...

絞り込み条件を変える

File::Stat#setgid? -> bool (3021.0)

setgidされている時に真を返します。

...setgidされている時に真を返します。

//emlist[][ruby]{
Dir.glob("/usr/sbin/*") {|bd|
if File::Stat.new(bd).setgid?
puts
bd
end
}
#例
#...
#=> /usr/sbin/postqueue
#...
//}...

File::Stat#setuid? -> bool (3021.0)

setuidされている時に真を返します。

...setuidされている時に真を返します。

//emlist[][ruby]{
Dir.glob("/bin/*") {|bd|
if File::Stat.new(bd).setuid?
puts
bd
end
}
#例
#...
#=> /bin/ping
#=> /bin/su
#...
//}...

File::Stat#sticky? -> bool (3021.0)

stickyビットが立っている時に真を返します。

...stickyビットが立っている時に真を返します。

//emlist[][ruby]{
Dir.glob("/usr/bin/*") {|bd|
begin
if File::Stat.new(bd).sticky?
puts
bd
end
rescue
end
}
#例
#...
#=> /usr/bin/emacs-21.4
#...
//}...

RubyVM::InstructionSequence#absolute_path -> String | nil (3021.0)

self が表す命令シーケンスの絶対パスを返します。

...= RubyVM::InstructionSequence.compile('num = 1 + 2')
# => <RubyVM::InstructionSequence:<compiled>@<compiled>>
iseq.absolute_path
# => nil

例2: RubyVM::InstructionSequence.compile_file を使用した場合

# /tmp/method.rb
def hello
puts
"hello, world"
end

# irb
> iseq = Ruby...
...VM::InstructionSequence.compile_file('/tmp/method.rb')
> iseq.absolute_path # => "/tmp/method.rb"

@see RubyVM::InstructionSequence#path...
<< 1 2 > >>