種類
- 特異メソッド (44)
- 文書 (44)
- インスタンスメソッド (11)
クラス
- DateTime (11)
- OptionParser (22)
- Time (22)
キーワード
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (11) -
NEWS for Ruby 2
. 2 . 0 (10) -
NEWS for Ruby 2
. 5 . 0 (7) -
NEWS for Ruby 2
. 7 . 0 (5) - reject (22)
-
ruby 1
. 6 feature (11)
検索結果
先頭5件
-
Time
. parse(date , now = Time . now) -> Time (35534.0) -
...date を Date._parse によって
パースして Timeオブジェクトに変換します。
ブロック付きで呼ばれた場合、dateの年はブロックによって変換されます。
require 'time'
Time.parse(...) {|y| y < 100 ? (y >= 69 ? y + 1900 : y + 2000) : y}
与えられ......当要素が使われます。
require 'time'
time = Time.local(2019, 5, 1)
Time.parse("12:00", time) #=> 2019-05-01 12:00:00 +0900
下位の要素がなかったり壊れていた場合、最小値(1か0)が使われます。
@param date Time オブジェクトに変換可能な文字列......を指定します。
@param now 現在時刻をTime オブジェクトで指定します。
デフォルトはTime.nowとなります。
@raise ArgumentError dateに空文字列を与えた場合、発生します。
なお、1.9.2より前は例外は発生せず... -
Time
. parse(date , now = Time . now) {|year| year } -> Time (35534.0) -
...date を Date._parse によって
パースして Timeオブジェクトに変換します。
ブロック付きで呼ばれた場合、dateの年はブロックによって変換されます。
require 'time'
Time.parse(...) {|y| y < 100 ? (y >= 69 ? y + 1900 : y + 2000) : y}
与えられ......当要素が使われます。
require 'time'
time = Time.local(2019, 5, 1)
Time.parse("12:00", time) #=> 2019-05-01 12:00:00 +0900
下位の要素がなかったり壊れていた場合、最小値(1か0)が使われます。
@param date Time オブジェクトに変換可能な文字列......を指定します。
@param now 現在時刻をTime オブジェクトで指定します。
デフォルトはTime.nowとなります。
@raise ArgumentError dateに空文字列を与えた場合、発生します。
なお、1.9.2より前は例外は発生せず... -
DateTime
. parse(str = & # 39;-4712-01-01T00:00:00+00:00& # 39; , complete = true , start = Date :: ITALY) -> DateTime (21225.0) -
与えられた日時表現を解析し、 その情報に基づいて DateTime オブジェクトを生成します。
...与えられた日時表現を解析し、
その情報に基づいて DateTime オブジェクトを生成します。
年が "00" から "99" の範囲であれば、
年の下2桁表現であるとみなしこれを補います。
この振舞いを抑止したい場合は、ヒントとして......オ暦をつかい始めた日をあらわすユリウス日
@raise ArgumentError 正しくない日時になる組み合わせである場合に発生します。
例:
require 'date'
DateTime.parse('2001-02-03T12:13:14Z').to_s
# => "2001-02-03T12:13:14+00:00"
@see Date._parse, Date.parse... -
OptionParser
# reject(klass) -> () (3102.0) -
OptionParser#accept で登録したクラスとブロックを 自身から削除します。
...nParser#accept で登録したクラスとブロックを
自身から削除します。
@param klass 自身から削除したいクラスを指定します。
//emlist[例][ruby]{
require "optparse"
require "time"
def parse(option_parser)
option_parser.on("-t", "--time [TIME]", Time) do |time|......p time.class
end
option_parser.parse(ARGV)
end
opts = OptionParser.new
opts.accept(Time) do |s,|
begin
Time.parse(s) if s
rescue
raise OptionParser::InvalidArgument, s
end
end
parse(opts) # => Time
opts.reject(Time)
parse(opts) # => unsupported argument type: Time (ArgumentError)... -
OptionParser
. reject(klass) -> () (3102.0) -
OptionParser.accept メソッドで登録したブロックを削除します。
...ptionParser.accept メソッドで登録したブロックを削除します。
@param klass 削除したいクラスオブジェクトを指定します。
//emlist[例][ruby]{
require "optparse"
require "time"
def parse(option_parser)
option_parser.on("-t", "--time [TIME]", Time) do |time|......parser.parse(ARGV)
end
OptionParser.accept(Time) do |s,|
begin
Time.parse(s) if s
rescue
raise OptionParser::InvalidArgument, s
end
end
opts1 = OptionParser.new
parse(opts1) # => Time
OptionParser.reject(Time)
opts2 = OptionParser.new
parse(opts2) # => unsupported argument type: Time......(ArgumentError)
//}... -
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (192.0) -
1.6.8から1.8.0への変更点(まとめ) * ((<1.6.8から1.8.0への変更点(まとめ)/インタプリタの変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたクラス/モジュール>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたメソッド>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加された定数>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張されたクラス/メソッド(互換性のある変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/変更されたクラス/メソッド(互換性のない変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/文法の変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/正規表現>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Marshal>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Windows 対応>)) * ((<1.6.8から1.8.0への変更点(まとめ)/廃止された(される予定の)機能>)) * ((<1.6.8から1.8.0への変更点(まとめ)/ライブラリ>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張ライブラリAPI>)) * ((<1.6.8から1.8.0への変更点(まとめ)/バグ修正>)) * ((<1.6.8から1.8.0への変更点(まとめ)/サポートプラットフォームの追加>))
...い。break が例外になる。
Proc.new {|a,b,c| p [a,b,c]}.call(1,2)
=> -:1: wrong # of arguments (2 for 3) (ArgumentError)
from -:1:in `call'
from -:1
ruby 1.6.8 (2002-12-24) [i586-linux]......します。
=== Time
: ((<Time#getgm|Time/getgm>)) [new]
: ((<Time#getlocal|Time/getlocal>)) [new]
: ((<Time#getutc|Time/getutc>)) [new]
: ((<Time#gmt_offset|Time/gmt_offset>)) [new]
: ((<Time#gmtoff|Time/gmtoff>)) [new]
: ((<Time#utc_offset|Time/utc_offset>)) [new].......times も残っていますが、warningが出ます)
: ((<Time#to_a|Time/to_a>)) [change]
: ((<Time#zone|Time/zone>)) [change]
gmtime なタイムゾーンに対して"UTC"を返すようになりました
(以前は環境依存。大抵の場合"GMT")
== 文法の変更
: parse... -
ruby 1
. 6 feature (132.0) -
ruby 1.6 feature ruby version 1.6 は安定版です。この版での変更はバグ修正がメイン になります。
...7 feature>)) の 2002-06-24 も参照)
p "#{ "" # comment }"
=> ruby 1.6.8 (2002-10-04) [i586-linux]
""
=> -:1: parse error
ruby 1.7.3 (2002-10-04) [i586-linux]
: SizedQueue#deq, #shift
: SizedQueue#enq
追加(push, pop の別名)。これらが定......$; が有効にな
るのは引数省略時だけでした。
$; = ":"
p "a:b:c".split(nil)
=> -:2:in `split': bad separator (ArgumentError)
from -:2
ruby 1.6.7 (2002-03-01) [i586-linux]
=> ruby 1.6.7 (2002-07-30) [i586-linux]
["a", "b", "c"]
: 2002-06......class for true (TypeError)
ruby 1.6.6 (2001-12-26) [i586-linux]
=> ruby 1.6.7 (2002-03-01) [i586-linux]
"foo"
: ((<time>)), URI
追加されました。
: Ruby/Tk
バグ修正、機能追加 ((<ruby-dev:16139>)),((<ruby-dev:16153>))。
: 数値リテラルの... -
NEWS for Ruby 2
. 2 . 0 (90.0) -
NEWS for Ruby 2.2.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...* Float
* 追加: Float#next_float
* 追加: Float#prev_float
* File
* 追加: File.birthtime
* 追加: File#birthtime
* File::Stat
* 追加: File::Stat#birthtime
* GC
* GC.latest_gc_info は現在のGCのステータスを再現するために :state を返す......el
* 追加: Kernel.#itself(Object#itself)
* 改善: Kernel.#throw は、対応する catch ブロックがないとき ArgumentError ではなく
ArgumentError のサブクラスである UncaughtThrowError を発生させるようになりました
* Process
* 拡張: Process......h_strongly_connected_component_from はブロックを省略すると Enumerator を返すようになりました。
* xmlrpc
* LibXMLStreamParser という新しいパーサーを追加しました
=== 標準添付ライブラリの互換性 (機能追加とバグ修正を除く)
* math... -
NEWS for Ruby 2
. 7 . 0 (84.0) -
NEWS for Ruby 2.7.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...ame": "Alice",
"age": 30,
"children": [{ "name": "Bob", "age": 2 }]
}
END
JSON.parse(json, symbolize_names: true) in {name: "Alice", children: [{name: name, age: age}]}
p name #=> "Bob"
p age #=> 2
JSON.parse(json, symbolize_names: true) in {name: "Alice", children: [{name: "Charlie", age: a......ド引数付きで呼び出すとArgumentErrorになります。 14183
//emlist[][ruby]{
def foo(h, **nil); end; foo(key: 1) # ArgumentError
def foo(h, **nil); end; foo(**{key: 1}) # ArgumentError
def foo(h, **nil); end; foo("str" => 1) # ArgumentError
def foo(h, **nil); end; foo({key: 1}......ymbol#end_with?が追加されました。 16348
* Time
* 新規メソッド
* Time#ceilが追加されました。 15772
* Time#floorが追加されました。 15653
* 変更されたメソッド
* Time#inspectがTime#to_sから分離されて、秒未満も... -
NEWS for Ruby 2
. 5 . 0 (36.0) -
NEWS for Ruby 2.5.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...するようになりました
13941
* File.rename GVL を解放するようになりました 13951
* File::Stat#atime, File::Stat#mtime, File::Stat#ctime
Windows 8 以降でタイムスタンプの分数表現をサポートしました 13726
* File::Stat#ino, File.identica......する場合 Process.#times の精度を改良しました 11952
* Process.last_status を追加。$? と同じです 14043
* Range
* Range.new no longer hides exceptions when comparing begin and
end with #<=> and raise a "bad value for range" ArgumentError
but instead lets th......SON.parse
https://github.com/ruby/psych/pull/333, https://github.com/ruby/psych/pull/337
* Add Psych::Handler#event_location
https://github.com/ruby/psych/pull/326
* Make frozen string literal = true
https://github.com/ruby/psych/pull/320
* Preserve time zon...