るりまサーチ

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

別のキーワード

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

ライブラリ

クラス

キーワード

検索結果

<< 1 2 3 > >>

CSV#puts(row) -> self (15144.0)

自身に row を追加します。

.../emlist[例 配列を指定][ruby]{
require "csv"

File
.write("test.csv", <<CSV)
id,first name,last name,age
1,taro,tanaka,20
2,jiro,suzuki,18
3,ami,sato,19
4,yumi,adachi,21
CSV
CSV.open("test.csv", "a") do |csv|
csv.puts(["5", "saburo", "kondo", "34"])
end

print File.read("test.csv")
# => id,fir...
...ro,tanaka,20
# 2,jiro,suzuki,18
# 3,ami,sato,19
# 4,yumi,adachi,21
# 5,saburo,kondo,34
//}

//emlist[例 CSV::Row を指定][ruby]{
require "csv"

File
.write("test.csv", <<CSV)
id,first name,last name,age
1,taro,tanaka,20
2,jiro,suzuki,18
3,ami,sato,19
4,yumi,adachi,21
CSV
CSV.open("test...
....csv", "a") do |csv|
row = CSV::Row.new(["id", "first name", "last name", "age"], ["5", "saburo", "kondo", "34"])
csv.add_row(row)
end

print File.read("test.csv")
# => "id", first name,last name,age
# 1,taro,tanaka,20
# 2,jiro,suzuki,18
# 3,ami,sato,19
# 4,yumi,adachi,21
# 5,sabu...

File#flock(operation) -> 0 | false (9169.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 することで...

WIN32OLE_TYPE#helpfile -> String | nil (6113.0)

オブジェクトに関連付けられたヘルプファイルのフルパス名。

...合はnilを返します。

tobj = WIN32OLE_TYPE.new('Microsoft Excel 14.0 Object Library', 'Worksheet')
puts
tobj.helpfile # => C:\...\VBAXL9.CHM
WIN32OLE.ole_show_help tobj.helpfile, tobj.helpcontext
# 注)WIN32OLE.ole_show_help(tobj) の呼び出しが望ましい

当メソッド...
...てい
ない場合があることに注意してください。

また、返送値はOLEサーバの登録値をそのまま利用するため、Rubyのパス名形式
(ディレクトリ区切りは「/」)ではなく、Windowsのパス名形式(ディレクト
リ区切りは「\」)で...

RubyVM::InstructionSequence#base_label -> String (3025.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 (3025.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 (3019.0)

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

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

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

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

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

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

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

File::Stat#setgid? -> bool (3019.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 (3019.0)

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

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

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