るりまサーチ

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

別のキーワード

  1. fiddle ruby_free
  2. rbconfig ruby
  3. fiddle build_ruby_platform
  4. rake ruby
  5. rubygems/defaults ruby_engine

ライブラリ

キーワード

検索結果

<< < 1 2 3 >>

Rake::PackageTask#package_files=(file_list) (3125.0)

パッケージに含むファイルリストを設定します。

...list ファイルリストを指定します。

//emlist[][ruby]{
# Rakefile での記載例とする
require
'rake/packagetask'

IO.write("test1.rb", "test")
IO.write("test2.rb", "test")

Rake::PackageTask.new("sample", "1.0.0") do |package_task|
package_task.package_files # => []
package_task...
....package_files = FileList.new("test1.rb", "test2.rb")
package_task.package_files # => ["test1.rb", "test2.rb"]
end
//}...

Rake::Application#add_loader(ext, loader) (3119.0)

与えられた拡張子で終わるファイル名のファイルをロードするためのローダーを 自身に追加します。

...@param ext 拡張子を指定します。

@param loader ローダーを指定します。

//emlist[例][ruby]{
require
"rake/loaders/makefile"

# Rakefile での記載例とする

t
ask default: :test
t
ask :test

makefile =<<-EOS
<< <<-'SAMPLE_MF'
# Comments
a: a1 a2 a3 a4
EOS
IO.write("sample.m...
...f", makefile)
Rake.application.add_loader("mf", Rake::MakefileLoader.new)
Rake.application.add_import("sample.mf")
Rake::Task.task_defined?("a") # => false
Rake.application.load_imports
Rake::Task.task_defined?("a") # => true
//}...

StringIO#reopen(sio) -> StringIO (3116.0)

自身が表す文字列が指定された StringIO と同じものになります。

...自身が表す文字列が指定された StringIO と同じものになります。

@param sio 自身が表したい StringIO を指定します。

//emlist[例][ruby]{
require
'stringio'
sio = StringIO.new("hoge", 'r+')
sio2 = StringIO.new("foo", 'r+')
sio.reopen(sio2)
p sio.read...

Pathname#each_line(*args) {|line| ... } -> nil (3073.0)

IO.foreach(self.to_s, *args, &block) と同じです。

...ch(self.to_s, *args, &block) と同じです。

//emlist[例][ruby]{
require
"pathname"

IO.write("testfile", "line1\nline2,\nline3\n")
Pathname("testfile").each_line
# => #<Enumerator: IO:foreach("testfile")>
//}

//emlist[例 ブロックを指定][ruby]{
require
"pathname"

IO.write("testfile",...
..."line1\nline2,\nline3\n")
Pathname("testfile").each_line {|f| p f }

# => "line1\n"
# => "line2,\n"
# => "line3\n"
//}

//emlist[例 limit を指定][ruby]{
require
"pathname"

IO.write("testfile", "line1\nline2,\nline3\n")
Pathname("testfile").each_line(4) {|f| p f }

# => "line"
# => "1\n"
# => "l...
...ine"
# => "2,\n"
# => "line"
# => "3\n"
//}

//emlist[例 sep を指定][ruby]{
require
"pathname"

IO.write("testfile", "line1\nline2,\nline3\n")
Pathname("testfile").each_line(",") {|f| p f }

# => "line1\nline2,"
# => "\nline3\n"
//}

@see IO.foreach...

OptionParser#load(filename = nil) -> bool (3019.0)

指定された filename を読み込んで各行をまとめたものに対して OptionParser#parse を行ないます。

...指定された filename を読み込んで各行をまとめたものに対して OptionParser#parse を行ないます。

パースが成功した場合に true を返します。
ファイルが存在しなかった場合に false を返します。

@param filename 各行をパースしたい...
...options/ に
プログラムのサフィックスを付けた '~/.options/コマンド名' というファイルをパースします。

//emlist[例][ruby]{
require
"optparse"

IO.write("options.txt", %w(-a --b).join("\n"))
options = { a: false, b: false }
OptionParser.new do |opt|...
...opt.on('-a') { |v| options[:a] = v }
opt.on('--b') {|v| options[:b] = v }
opt.load("options.txt") # => true
opt.load("not_exist.txt") # => false
end

p options # => {:a=>true, :b=>true}
//}...

絞り込み条件を変える

StringIO#closed? -> bool (3019.0)

自身が既に close されていた場合に true を返します。そうでない場合は、false を返します。

...身が既に close されていた場合に true を返します。そうでない場合は、false を返します。

//emlist[例][ruby]{
require
"stringio"
sio = StringIO.open("hoge")
p sio.closed? # => false
sio.close_read
p sio.closed? # => false
sio.close_write
p sio.closed? # => true
//}...
<< < 1 2 3 >>