るりまサーチ

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

別のキーワード

  1. etc sc_xopen_enh_i18n
  2. rsa n
  3. rsa n=
  4. pop n_mails
  5. pop n_bytes

ライブラリ

モジュール

キーワード

検索結果

<< 1 2 3 ... > >>

Integer#times -> Enumerator (21334.0)

self 回だけ繰り返します。 self が正の整数でない場合は何もしません。

...れます。

//emlist[][ruby]{
3.times { puts "Hello, World!" } # Hello, World! と3行続いて表示される。
0.times { puts "Hello, World!" } # 何も表示されない。
5.times {|n| print n } # 01234 と表示される。
//}

@see Integer#upto, Integer#downto, Numeric#step...

Float#next_float -> Float (15319.0)

浮動小数点数で表現可能な self の次の値を返します。

...ます。

Float::MAX.next_float、Float::INFINITY.next_float は
Float::INFINITY を返します。Float::NAN.next_float は
Float::NAN を返します。

//emlist[例][ruby]{
p 0.01.next_float # => 0.010000000000000002
p 1.0.next_float # => 1.0000000000000002
p 100.0.next_float # => 100.000000...
...001

p 0.01.next_float - 0.01 # => 1.734723475976807e-18
p 1.0.next_float - 1.0 # => 2.220446049250313e-16
p 100.0.next_float - 100.0 # => 1.4210854715202004e-14

f = 0.01; 20.times { printf "%-20a %s\n", f, f.to_s; f = f.next_float }
# => 0x1.47ae147ae147bp-7 0.01
# 0x1.47ae147ae147cp-7 0....
...0x1.47ae147ae147dp-7 0.010000000000000004
# 0x1.47ae147ae147ep-7 0.010000000000000005
# 0x1.47ae147ae147fp-7 0.010000000000000007
# 0x1.47ae147ae148p-7 0.010000000000000009
# 0x1.47ae147ae1481p-7 0.01000000000000001
# 0x1.47ae147ae1482p-7 0.010000000000000012
# 0x1.47ae147ae1483p...

Socket::AncillaryData#timestamp -> Time (15207.0)

タイムスタンプ制御メッセージに含まれる時刻を Time オブジェクト で返します。

...T/SCM_TIMESTAMP (micro second) GNU/Linux, FreeBSD, NetBSD, OpenBSD, Solaris, MacOS X
* SOL_SOCKET/SCM_TIMESTAMPNS (nano second) GNU/Linux
* SOL_SOCKET/SCM_BINTIME (2**(-64) second) FreeBSD

require 'socket'

A
ddrinfo.udp("127.0.0.1", 0).bind {|s1|
A
ddrinfo.udp("127.0.0.1", 0).bind {|s2...
...ET, :TIMESTAMP, true)
s2.send "a", 0, s1.local_address
ctl = s1.recvmsg.last
p ctl
#=> #<Socket::AncillaryData: INET SOCKET TIMESTAMP 2009-02-24 17:35:46.775581>
t = ctl.timestamp
p t #=> 2009-02-24 17:35:46 +0900
p t.usec #=> 775581
p t.nsec...
...#=> 775581000
}
}

@see Socket::Constants::SCM_TIMESTAMP,
Socket::Constants::SCM_TIMESTAMPNS,
Socket::Constants::SCM_BINTIME,
Socket::Constants::SO_TIMESTAMP,
Socket::Constants::SO_TIMESTAMPNS,
Socket::Constants::SO_BINTIME...

Rake::FileCreationTask#timestamp -> Rake::EarlyTime (15201.0)

どんなタイムスタンプよりも前の時刻をあらわすタイムスタンプを返します。

...どんなタイムスタンプよりも前の時刻をあらわすタイムスタンプを返します。


@see [[FileTask#timestamp]]...

Enumerator::Lazy#enum_for(method = :each, *args) -> Enumerator::Lazy (12361.0)

Object#to_enum と同じですが、Enumerator::Lazy を返します。

...Object#to_enum と同じですが、Enumerator::Lazy を返します。

to_enum は「ブロック付きで呼ぶとループを実行し、ブロックを省略した場合は
Enumerator を返す」ようなメソッドを定義するときによく使われます。
このときに lazy 性が...
...に、Lazy#to_enum は
素のEnumerator ではなく Enumerator::Lazy を返すようになっています。

//emlist[例][ruby]{
module Enumerable
# 要素をn回ずつ繰り返すメソッド
# 例:[1,2,3].repeat(2) #=> [1,1,2,2,3,3]
def repeat(n)
raise ArgumentError if n < 0
if...
...ock_given?
each do |*val|
n
.times { yield *val }
end
else
to_enum(:repeat, n)
end
end
end

r = 1..10
p r.map{|n| n**2}.repeat(2).first(5)
#=> [1, 1, 4, 4, 9]

r = 1..Float::INFINITY
p r.lazy.map{|n| n**2}.repeat(2).first(5)
#=> [1, 1, 4, 4, 9]

# Lazy#to_enum の...

絞り込み条件を変える

Enumerator::Lazy#enum_for(method = :each, *args) {|*args| block} -> Enumerator::Lazy (12361.0)

Object#to_enum と同じですが、Enumerator::Lazy を返します。

...Object#to_enum と同じですが、Enumerator::Lazy を返します。

to_enum は「ブロック付きで呼ぶとループを実行し、ブロックを省略した場合は
Enumerator を返す」ようなメソッドを定義するときによく使われます。
このときに lazy 性が...
...に、Lazy#to_enum は
素のEnumerator ではなく Enumerator::Lazy を返すようになっています。

//emlist[例][ruby]{
module Enumerable
# 要素をn回ずつ繰り返すメソッド
# 例:[1,2,3].repeat(2) #=> [1,1,2,2,3,3]
def repeat(n)
raise ArgumentError if n < 0
if...
...ock_given?
each do |*val|
n
.times { yield *val }
end
else
to_enum(:repeat, n)
end
end
end

r = 1..10
p r.map{|n| n**2}.repeat(2).first(5)
#=> [1, 1, 4, 4, 9]

r = 1..Float::INFINITY
p r.lazy.map{|n| n**2}.repeat(2).first(5)
#=> [1, 1, 4, 4, 9]

# Lazy#to_enum の...

Enumerator::Lazy#to_enum(method = :each, *args) -> Enumerator::Lazy (12361.0)

Object#to_enum と同じですが、Enumerator::Lazy を返します。

...Object#to_enum と同じですが、Enumerator::Lazy を返します。

to_enum は「ブロック付きで呼ぶとループを実行し、ブロックを省略した場合は
Enumerator を返す」ようなメソッドを定義するときによく使われます。
このときに lazy 性が...
...に、Lazy#to_enum は
素のEnumerator ではなく Enumerator::Lazy を返すようになっています。

//emlist[例][ruby]{
module Enumerable
# 要素をn回ずつ繰り返すメソッド
# 例:[1,2,3].repeat(2) #=> [1,1,2,2,3,3]
def repeat(n)
raise ArgumentError if n < 0
if...
...ock_given?
each do |*val|
n
.times { yield *val }
end
else
to_enum(:repeat, n)
end
end
end

r = 1..10
p r.map{|n| n**2}.repeat(2).first(5)
#=> [1, 1, 4, 4, 9]

r = 1..Float::INFINITY
p r.lazy.map{|n| n**2}.repeat(2).first(5)
#=> [1, 1, 4, 4, 9]

# Lazy#to_enum の...

Enumerator::Lazy#to_enum(method = :each, *args) {|*args| block} -> Enumerator::Lazy (12361.0)

Object#to_enum と同じですが、Enumerator::Lazy を返します。

...Object#to_enum と同じですが、Enumerator::Lazy を返します。

to_enum は「ブロック付きで呼ぶとループを実行し、ブロックを省略した場合は
Enumerator を返す」ようなメソッドを定義するときによく使われます。
このときに lazy 性が...
...に、Lazy#to_enum は
素のEnumerator ではなく Enumerator::Lazy を返すようになっています。

//emlist[例][ruby]{
module Enumerable
# 要素をn回ずつ繰り返すメソッド
# 例:[1,2,3].repeat(2) #=> [1,1,2,2,3,3]
def repeat(n)
raise ArgumentError if n < 0
if...
...ock_given?
each do |*val|
n
.times { yield *val }
end
else
to_enum(:repeat, n)
end
end
end

r = 1..10
p r.map{|n| n**2}.repeat(2).first(5)
#=> [1, 1, 4, 4, 9]

r = 1..Float::INFINITY
p r.lazy.map{|n| n**2}.repeat(2).first(5)
#=> [1, 1, 4, 4, 9]

# Lazy#to_enum の...

Thread::ConditionVariable#signal -> self (12243.0)

状態変数を待っているスレッドを1つ再開します。再開された スレッドは Thread::ConditionVariable#wait で指定した mutex のロックを試みます。

...read::ConditionVariable#wait
で指定した mutex のロックを試みます。

@return 常に self を返します。

//emlist[例][ruby]{
mutex = Mutex.new
cv = ConditionVariable.new
flg = true

3.times {
Thread.start {
mutex.synchronize {
puts "a1"
while (flg)
cv.wai...
...t(mutex)
end
puts "a2"
}
}
}

Thread.start {
mutex.synchronize {
flg = false
cv.signal
}
}

sleep 1

# => a1
# => a1
# => a1
# => a2
//}...

ThreadsWait#join_nowait(*threads) -> () (12207.0)

終了を待つスレッドの対象として、threads で指定されたスレッドを指定します。 しかし、実際には終了をまちません。

...threads で指定されたスレッドを指定します。
しかし、実際には終了をまちません。

@param threads 複数スレッドの終了を待つスレッドに指定されたthreadsを加えます。

require 'thwait'

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

thall = ThreadsWait.new
p thall.threads #=> []
thall.join_nowait(*threads)
p thall.threads #=> [#<Thread:0x21638 sleep>, #<Thread:0x215ac sleep>, #<Thread:0x21520 sleep>, #<Thread:0x21494 sleep>, #<Thread:0x21408 sleep>]
# 実際には終了を待ってい...

絞り込み条件を変える

<< 1 2 3 ... > >>