458件ヒット
[101-200件を表示]
(0.058秒)
別のキーワード
ライブラリ
- ビルトイン (182)
- bigdecimal (24)
- erb (12)
- optparse (48)
-
rubygems
/ specification (12) - stringio (12)
- strscan (12)
- un (156)
クラス
- BigDecimal (24)
- ERB (12)
- File (12)
- Float (12)
-
Gem
:: Specification (12) - Integer (12)
- Mutex (2)
- Numeric (12)
- OptionParser (48)
- Rational (12)
- StringIO (12)
- StringScanner (12)
- Thread (86)
-
Thread
:: Mutex (10) - ThreadGroup (24)
モジュール
- Kernel (156)
キーワード
- add (12)
-
add
_ runtime _ dependency (12) -
backtrace
_ locations (24) - chmod (12)
- cp (12)
- help (24)
- httpd (12)
- inspect (12)
- install (12)
- list (12)
- ln (12)
-
matched
_ size (12) - mkdir (12)
- mkmf (12)
- mv (12)
-
report
_ on _ exception (9) -
report
_ on _ exception= (9) - rm (12)
- rmdir (12)
- sleep (12)
-
to
_ s (20) - touch (12)
- truncate (96)
-
wait
_ writable (12) - wakeup (12)
検索結果
先頭5件
-
Rational
# truncate(precision = 0) -> Rational | Integer (3113.0) -
小数点以下を切り捨てて値を整数に変換します。
...[例][ruby]{
Rational(2, 3).to_i # => 0
Rational(3).to_i # => 3
Rational(300.6).to_i # => 300
Rational(98, 71).to_i # => 1
Rational(-31, 2).to_i # => -15
//}
precision を指定した場合は指定した桁数で切り捨てた整数か
Rational を返します。
//emlist[例][ruby]{
Rat......ional('-123.456').truncate(+1) # => (-617/5)
Rational('-123.456').truncate(+1).to_f # => -123.4
Rational('-123.456').truncate(0) # => -123
Rational('-123.456').truncate(-1) # => -120
//}
@see Rational#ceil, Rational#floor... -
Float
# truncate -> Integer (3107.0) -
小数点以下を切り捨てて値を整数に変換します。
...小数点以下を切り捨てて値を整数に変換します。
//emlist[例][ruby]{
2.8.truncate # => 2
(-2.8).truncate # => -2
//}
@see Numeric#round, Numeric#ceil, Numeric#floor... -
Float
# truncate(ndigits = 0) -> Integer | Float (3107.0) -
小数点以下を切り捨てて値を整数に変換します。
...す。
小数点位置から左に少なくとも n 個の 0 が並びます。
//emlist[例][ruby]{
2.8.truncate # => 2
(-2.8).truncate # => -2
1.234567.truncate(2) # => 1.23
34567.89.truncate(-2) # => 34500
//}
@see Numeric#round, Numeric#ceil, Numeric#floor... -
Gem
:: Specification # add _ runtime _ dependency(gem , *requirements) -> [Gem :: Dependency] (3107.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 の... -
Kernel
# mkmf -> () (67.0) -
mkmf を使って Makefile を作成します。
...成します。
ruby -run -e mkmf -- [OPTION] EXTNAME [OPTION]
-d ARGS run dir_config
-h ARGS run have_header
-l ARGS run have_library
-f ARGS run have_func
-v ARGS run have_var
-t ARGS run have_type
-m ARGS run have_macro
-c ARGS run have_const
--vendor install to vendor_ruby... -
StringScanner
# matched _ size -> Integer | nil (37.0) -
前回マッチした部分文字列の長さを返します。 前回マッチに失敗していたら nil を返します。
...st[][ruby]{
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]{
r... -
ThreadGroup
# add(thread) -> self (31.0) -
スレッド thread が属するグループを自身に変更します。
...freeze されているか enclose されている場合にも発生します。
//emlist[例][ruby]{
puts "Initial group is #{ThreadGroup::Default.list}"
# => Initial group is [#<Thread:0x4a49168 run>]
tg = ThreadGroup.new
t1 = Thread.new { sleep }
t2 = Thread.new { sleep }
puts "t1 is #{t1}" # =......> t1 is #<Thread:0x50bef60>
puts "t2 is #{t2}" # => t2 is #<Thread:0x50beed0>
tg.add(t1)
puts "Initial group now #{ThreadGroup::Default.list}"
# => Initial group now [#<Thread:0x3039168 run>, #<Thread:0x50beed0 run>]
puts "tg group now #{tg.list}"
# => tg group now [#<Thread:0x50bef60 run>]
//}... -
Thread
# wakeup -> self (29.0) -
停止状態(stop)のスレッドを実行可能状態(run)にします。
...を実行可能状態(run)にします。
@raise ThreadError 死んでいるスレッドに対して実行すると発生します。
//emlist[例][ruby]{
c = Thread.new { Thread.stop; puts "hey!" }
sleep 0.1 while c.status!='sleep'
c.wakeup
c.join
# => "hey!"
//}
@see Thread#run, Thread.stop... -
Thread
# report _ on _ exception -> bool (25.0) -
真の場合、そのスレッドが例外によって終了した時に、その内容を $stderr に報告します。
...るかどうかを true か false で指定します。
//emlist[例][ruby]{
a = Thread.new{ Thread.stop; raise }
a.report_on_exception = true
a.report_on_exception # => true
a.run
# => #<Thread:0x00007fc3f48c7908@(irb):1 run> terminated with exception (report_on_exception is true):
# Tracebac......k (most recent call last):
# (irb):1:in `block in irb_binding': unhandled exception
# #<Thread:0x00007fc3f48c7908@(irb):1 dead>
b = Thread.new{ Thread.stop; raise }
b.report_on_exception = false
b.run # => #<Thread:0x00007fc3f48aefc0@(irb):4 dead>
//}
@see Thread.report_on_exception... -
Thread
# report _ on _ exception=(newstate) (25.0) -
真の場合、そのスレッドが例外によって終了した時に、その内容を $stderr に報告します。
...るかどうかを true か false で指定します。
//emlist[例][ruby]{
a = Thread.new{ Thread.stop; raise }
a.report_on_exception = true
a.report_on_exception # => true
a.run
# => #<Thread:0x00007fc3f48c7908@(irb):1 run> terminated with exception (report_on_exception is true):
# Tracebac......k (most recent call last):
# (irb):1:in `block in irb_binding': unhandled exception
# #<Thread:0x00007fc3f48c7908@(irb):1 dead>
b = Thread.new{ Thread.stop; raise }
b.report_on_exception = false
b.run # => #<Thread:0x00007fc3f48aefc0@(irb):4 dead>
//}
@see Thread.report_on_exception... -
OptionParser
# help -> String (19.0) -
サマリの文字列を返します。
...サマリの文字列を返します。
//emlist[例][ruby]{
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:...