るりまサーチ

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

別のキーワード

  1. rss date
  2. rss date=
  3. date iso8601
  4. date rfc3339
  5. date jisx0301

クラス

キーワード

検索結果

<< 1 2 > >>

Hash#update(*others) -> self (3103.0)

selfとothersのハッシュの内容を順番にマージ(統合)します。

...mlist[][ruby]{
foo = {1 => 'a', 2 => 'b', 3 => 'c'}
bar = {2 => 'B', 3 => 'C', 4 => 'D'}

p foo.update(bar) #=> {1=>"a", 2=>"B", 3=>"C", 4=>"D"}
p foo #=> {1=>"a", 2=>"B", 3=>"C", 4=>"D"}

p foo.update(bar) {|key, foo_val, bar_val| foo_val + bar_val } # => {1=>"a", 2=>"BB", 3=>"CC", 4=>"DD"}
p foo...

Hash#update(*others) {|key, self_val, other_val| ... } -> self (3103.0)

selfとothersのハッシュの内容を順番にマージ(統合)します。

...mlist[][ruby]{
foo = {1 => 'a', 2 => 'b', 3 => 'c'}
bar = {2 => 'B', 3 => 'C', 4 => 'D'}

p foo.update(bar) #=> {1=>"a", 2=>"B", 3=>"C", 4=>"D"}
p foo #=> {1=>"a", 2=>"B", 3=>"C", 4=>"D"}

p foo.update(bar) {|key, foo_val, bar_val| foo_val + bar_val } # => {1=>"a", 2=>"BB", 3=>"CC", 4=>"DD"}
p foo...

Hash#update(other) -> self (3103.0)

selfとotherのハッシュの内容をマージ(統合)します。

...mlist[][ruby]{
foo = {1 => 'a', 2 => 'b', 3 => 'c'}
bar = {2 => 'B', 3 => 'C', 4 => 'D'}

p foo.update(bar) #=> {1=>"a", 2=>"B", 3=>"C", 4=>"D"}
p foo #=> {1=>"a", 2=>"B", 3=>"C", 4=>"D"}

p foo.update(bar) {|key, foo_val, bar_val| foo_val + bar_val } # => {1=>"a", 2=>"BB", 3=>"CC", 4=>"DD"}
p foo...

Hash#update(other) {|key, self_val, other_val| ... } -> self (3103.0)

selfとotherのハッシュの内容をマージ(統合)します。

...mlist[][ruby]{
foo = {1 => 'a', 2 => 'b', 3 => 'c'}
bar = {2 => 'B', 3 => 'C', 4 => 'D'}

p foo.update(bar) #=> {1=>"a", 2=>"B", 3=>"C", 4=>"D"}
p foo #=> {1=>"a", 2=>"B", 3=>"C", 4=>"D"}

p foo.update(bar) {|key, foo_val, bar_val| foo_val + bar_val } # => {1=>"a", 2=>"BB", 3=>"CC", 4=>"DD"}
p foo...

Time#strftime(format) -> String (195.0)

時刻を format 文字列に従って文字列に変換した結果を返します。

...m,pm)
* %p: 午前または午後(AM,PM)
* %Q: 1970-01-01 00:00:00 UTC からの経過ミリ秒 (Time#strftime は対応していませんが、Date#strftime で使えます)
* %R: 24時間制の時刻。%H:%M と同等。
* %r: 12時間制の時刻。%I:%M:%S %p と同等。
* %S: 秒(00-...
...ロンが入った秒まで含むUTCからのオフセット (例 +09:00:00)
* %%: %自身
* %+: date(1)の形式 (%a %b %e %H:%M:%S %Z %Y) (Time#strftime は対応していませんが、Date#strftime で使えます)

このメソッドは strftime(3) や glibcの仕様を参考に作成され...
...ndar date (basic)
p t.strftime("%F") # => 2001-02-03 Calendar date (extended)
p t.strftime("%Y-%m") # => 2001-02 Calendar date, reduced accuracy, specific month
p t.strftime("%Y") # => 2001 Calendar date, re...

絞り込み条件を変える

Range#cover?(obj) -> bool (75.0)

obj が範囲内に含まれている時に true を返します。

...emlist[Date, DateTime の例][ruby]{
require 'date'
(Date.today - 365 .. Date.today + 365).include?(Date.today) #=> true
(Date.today - 365 .. Date.today + 365).include?(DateTime.now) #=> false
(Date.today - 365 .. Date.today + 365).cover?(Date.today) #=> true
(Date.today - 365 .. Date.today...
...+ 365).cover?(DateTime.now) #=> true
//}


@see Range#include?, Range#===...
...+ 365).cover?(DateTime.now) #=> true
//}...

Range#===(obj) -> bool (45.0)

始端と終端の中に obj があるとき、true を返します。 そうでないとき、false を返します。

...りません。

//emlist[例][ruby]{
require 'date'
p (Date.today - 100...Date.today + 100).include?(DateTime.now) #=> false
p (Date.today - 100...Date.today + 100).cover?(DateTime.now) #=> true
p (Date.today - 100...Date.today + 100) === DateTime.now #=> true
# 2.5 以前は、=== は...

Module#autoload?(const_name) -> String | nil (39.0)

autoload 定数がまだ定義されてない(ロードされていない) ときにそのパス名を返します。 また、ロード済みなら nil を返します。

...を返します。
また、ロード済みなら nil を返します。

@param const_name String または Symbol で指定します。

@see Kernel.#autoload?

//emlist[例][ruby]{
autoload :Date, 'date'

autoload?(:Date) # => "date"
Date

autoload?(:Date) # => nil
autoload?(:Foo) # => nil
//}...

Random#rand -> Float (33.0)

一様な擬似乱数を発生させます。

...一つ選ばれる
prng.rand(Time.new(2012, 1, 1) ... Time.new(2013,1,1)) # => 2012-02-25 03:11:42 +0900
require 'date'
prng.rand(Date.new(2012, 1, 1) ... Date.new(2013,1,1)) # => #<Date: 2012-01-31 ((2455958j,0s,0n),+0s,2299161j)>
# Kernel.#rand とほぼ同様の使い勝手
prng = Random.new(1234...
...ため。
prng.rand(Time.new(2012, 1, 1) ... Time.new(2013,1,1)) # => 2012-02-25 03:11:42 +0900
# DateTime ではうまくいかない。というのは DateTime#- は
# Rational を返すため。
# Date#- も Rational を返すが通常は整数を表す Rational オブジェクトを返すため...

Random#rand(max) -> Integer | Float (33.0)

一様な擬似乱数を発生させます。

...一つ選ばれる
prng.rand(Time.new(2012, 1, 1) ... Time.new(2013,1,1)) # => 2012-02-25 03:11:42 +0900
require 'date'
prng.rand(Date.new(2012, 1, 1) ... Date.new(2013,1,1)) # => #<Date: 2012-01-31 ((2455958j,0s,0n),+0s,2299161j)>
# Kernel.#rand とほぼ同様の使い勝手
prng = Random.new(1234...
...ため。
prng.rand(Time.new(2012, 1, 1) ... Time.new(2013,1,1)) # => 2012-02-25 03:11:42 +0900
# DateTime ではうまくいかない。というのは DateTime#- は
# Rational を返すため。
# Date#- も Rational を返すが通常は整数を表す Rational オブジェクトを返すため...

絞り込み条件を変える

Random#rand(range) -> Integer | Float (33.0)

一様な擬似乱数を発生させます。

...一つ選ばれる
prng.rand(Time.new(2012, 1, 1) ... Time.new(2013,1,1)) # => 2012-02-25 03:11:42 +0900
require 'date'
prng.rand(Date.new(2012, 1, 1) ... Date.new(2013,1,1)) # => #<Date: 2012-01-31 ((2455958j,0s,0n),+0s,2299161j)>
# Kernel.#rand とほぼ同様の使い勝手
prng = Random.new(1234...
...ため。
prng.rand(Time.new(2012, 1, 1) ... Time.new(2013,1,1)) # => 2012-02-25 03:11:42 +0900
# DateTime ではうまくいかない。というのは DateTime#- は
# Rational を返すため。
# Date#- も Rational を返すが通常は整数を表す Rational オブジェクトを返すため...

Range#entries -> Array (27.0)

self を配列に変換します。

...# => [0, 1, 2, 3]
p ('a'..'c').to_a # => ["a", "b", "c"]
p (:a..:d).to_a # => [:a, :b, :c, :d]

require 'date'
p (Date.new(1965, 4, 14) .. Date.new(1965, 4, 14)).to_a # => [#<Date: 1965-04-14 ((2438865j,0s,0n),+0s,2299161j)>]

(1..).to_a # RangeError: cannot convert endless range to an arr...
<< 1 2 > >>