223件ヒット
[1-100件を表示]
(0.113秒)
クラス
- CSV (36)
- Dir (12)
- File (12)
-
File
:: Stat (60) - Object (12)
- Proc (7)
-
RubyVM
:: InstructionSequence (48) -
WIN32OLE
_ TYPE (12) -
Zlib
:: GzipWriter (24)
検索結果
先頭5件
-
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
RubyVM::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
RubyVM::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
#...
//}...