るりまサーチ

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

別のキーワード

  1. kernel require
  2. getoptlong require_order
  3. rubygems/custom_require require
  4. irb/ext/use-loader irb_require
  5. require execute

ライブラリ

クラス

キーワード

検索結果

<< 1 2 > >>

ERB#run(b=TOPLEVEL_BINDING) -> nil (18114.0)

ERB を b の binding で実行し、結果を標準出力へ印字します。

...ERB を b の binding で実行し、結果を標準出力へ印字します。

@param b eRubyスクリプトが実行されるときのbinding

//emlist[例][ruby]{
require
'erb'
erb = ERB.new("test <%= test1 %>\ntest <%= test2 %>\n")
test1 = "foo"
test2 = "bar"
erb.run
# test foo
# test bar
//}...

BigDecimal#truncate -> Integer (6107.0)

小数点以下の数を切り捨てて整数にします。

...ます)。
n が負のときは小数点以上 n 桁目を操作します
(小数点位置から左に少なくとも n 個の 0 が並びます)。

//emlist[][ruby]{
require
"bigdecimal"
BigDecimal("1.23456").truncate(4).to_f # => 1.2345
BigDecimal("15.23456").truncate(-1).to_f # => 10.0
//}...

BigDecimal#truncate(n) -> BigDecimal (6107.0)

小数点以下の数を切り捨てて整数にします。

...ます)。
n が負のときは小数点以上 n 桁目を操作します
(小数点位置から左に少なくとも n 個の 0 が並びます)。

//emlist[][ruby]{
require
"bigdecimal"
BigDecimal("1.23456").truncate(4).to_f # => 1.2345
BigDecimal("15.23456").truncate(-1).to_f # => 10.0
//}...

StringIO#truncate(len) -> Integer (6107.0)

自身のサイズが len になるように、自身を切り詰め、もしくは拡大します。 拡大した場合は、その部分を 0 で埋めます。 len を返します。

...でない時に発生します。

@raise Errno::EINVAL len がマイナスの時に発生します。

//emlist[例][ruby]{
require
"stringio"
a = StringIO.new("hoge", 'r+')
a.truncate(2)
a.string #=> "ho"
a.truncate(5)
a.string #=> "ho\000\000\000"
//}...

Gem::Specification#add_runtime_dependency(gem, *requirements) -> [Gem::Dependency] (3201.0)

この gem の RUNTIME 依存性を追加します。 実行時に必要となる gem を指定します。

...この gem の RUNTIME 依存性を追加します。
実行時に必要となる gem を指定します。

//emlist[][ruby]{
# https://github.com/rurema/bitclust/blob/v1.2.3/bitclust-core.gemspec#L25
s.add_runtime_dependency "progressbar", ">= 1.9.0", "< 2.0"
//}

@param gem 依存する gem の...
...名前か Gem::Dependency のインスタンスを指定します。

@param requirements バージョンの必要条件を 0 個以上指定します。デフォルトは ">= 0" です。

@see Gem::Specification#add_development_dependency, Gem::Dependency...

絞り込み条件を変える

StringScanner#matched_size -> Integer | nil (37.0)

前回マッチした部分文字列の長さを返します。 前回マッチに失敗していたら nil を返します。

...y]{
require
'strscan'

def run(encode)
utf8 = "\u{308B 3073 3044}" # るびい
s = StringScanner.new(utf8.encode(encode))
s.scan(/#{"\u{308B}".encode(encode)}/)
s.matched_size
end

p run("UTF-8") #=> 3
p run("EUC-JP") #=> 2
p run("Shift_Jis") #=> 2

//}

//emlist[例][ruby]{
require
'...

ThreadsWait#all_waits -> () (37.0)

指定されたスレッドすべてが終了するまで待ちます。 ブロックが与えられた場合、スレッド終了時にブロックを評価します。

...使用例
require
'thwait'

threads = []
5.times {|i|
threads << Thread.new { sleep 1; p Thread.current }
}

thall = ThreadsWait.new(*threads)
thall.all_waits{|th|
printf("end %s\n", th.inspect)
}

# 出力例
#=> #<Thread:0x214bc run>
#=> #<Thread:0x21548 run>
#=>...
...#<Thread:0x215d4 run>
#=> #<Thread:0x21660 run>
#=> #<Thread:0x21430 run>
#=> end #<Thread:0x214bc dead>
#=> end #<Thread:0x21548 dead>
#=> end #<Thread:0x215d4 dead>
#=> end #<Thread:0x21660 dead>
#=> end #<Thread:0x21430 dead>...

OptionParser#help -> String (19.0)

サマリの文字列を返します。

...
require
"optparse"

options = {}
opts = OptionParser.new do |opts|
opts.banner = "Usage: example.rb [options]"

opts.on("-v", "--[no-]verbose", "Run verbosely") do |v|
options[:verbose] = v
end
end

puts opts.help

# => Usage: example.rb [options]
# -v, --[no-]verbose Run...

OptionParser#to_s -> String (19.0)

サマリの文字列を返します。

...
require
"optparse"

options = {}
opts = OptionParser.new do |opts|
opts.banner = "Usage: example.rb [options]"

opts.on("-v", "--[no-]verbose", "Run verbosely") do |v|
options[:verbose] = v
end
end

puts opts.help

# => Usage: example.rb [options]
# -v, --[no-]verbose Run...
<< 1 2 > >>