るりまサーチ

最速Rubyリファレンスマニュアル検索!
46件ヒット [1-46件を表示] (0.031秒)
トップページ > クエリ:time[x] > クエリ:now[x] > クエリ:define[x]

別のキーワード

  1. time httpdate
  2. time rfc2822
  3. time iso8601
  4. time strptime
  5. time parse

検索結果

Data.define(*args) -> Class (18168.0)

Data クラスに新しいサブクラスを作って、それを返します。

...れています。

//emlist[例][ruby]{
Dog = Data.define(:name, :age)
fred = Dog.new("Fred", 5)
p fred.name # => "Fred"
p fred.age # => 5
//}

メンバの値を書き換えることはできません。

//emlist[例][ruby]{
Dog = Data.define(:name, :age)
fred = Dog.new("Fred", 5)
fred.age = 6 #...
...す。

//emlist[例][ruby]{
class HTTPFetcher
Response = Data.define(:body)
NotFound = Data.define

def get(url)
# ダミーの実装
if url == "http://example.com/"
Response.new(body: "Current time is #{Time.now}")
else
NotFound.new
end
end
end

def fetch(url)...
...(url)
in HTTPFetcher::Response(body)
body
in HTTPFetcher::NotFound
:NotFound
end
end

p fetch("http://example.com/") # => "Current time is 2023-01-10 10:00:53 +0900"
p fetch("http://example.com/404") # => :NotFound
//}

@param args 値オブジェクトのクラスを定義する...

Data.define(*args) {|subclass| block } -> Class (18168.0)

Data クラスに新しいサブクラスを作って、それを返します。

...れています。

//emlist[例][ruby]{
Dog = Data.define(:name, :age)
fred = Dog.new("Fred", 5)
p fred.name # => "Fred"
p fred.age # => 5
//}

メンバの値を書き換えることはできません。

//emlist[例][ruby]{
Dog = Data.define(:name, :age)
fred = Dog.new("Fred", 5)
fred.age = 6 #...
...す。

//emlist[例][ruby]{
class HTTPFetcher
Response = Data.define(:body)
NotFound = Data.define

def get(url)
# ダミーの実装
if url == "http://example.com/"
Response.new(body: "Current time is #{Time.now}")
else
NotFound.new
end
end
end

def fetch(url)...
...(url)
in HTTPFetcher::Response(body)
body
in HTTPFetcher::NotFound
:NotFound
end
end

p fetch("http://example.com/") # => "Current time is 2023-01-10 10:00:53 +0900"
p fetch("http://example.com/404") # => :NotFound
//}

@param args 値オブジェクトのクラスを定義する...

ruby 1.6 feature (84.0)

ruby 1.6 feature ruby version 1.6 は安定版です。この版での変更はバグ修正がメイン になります。

...}
=> ruby 1.6.7 (2002-03-01) [i586-linux]
nil

=> -:2:in `remove_instance_variable': instance variable @foo not defined (NameError)
ruby 1.6.7 (2002-04-10) [i586-linux]

: 2002-04-04: Integer#((<Integer/step>))

第二引数が 1 よりも小さい場...
...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>))。

: 数値リテラルの...
...として英数字を指定
できなくなりました。

p %q1..1

=> ruby 1.6.5 (2001-10-10) [i586-linux]
".."
=> -:1: unknown type of %string
p %q1..1
^
ruby 1.6.5 (2001-10-15) [i586-linux]

: String#=~

String#=~ の呼出で両辺と...

NEWS for Ruby 2.0.0 (72.0)

NEWS for Ruby 2.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...います
* 追加(実験的): Module#refine, スコープを限定してクラスやモジュールを拡張します。
* 拡張: Module#define_method は UnboundMethod を受け付けるようになりました
* 拡張: Module#const_get 修飾された定数名の文字列を受け...
...

* Time
* 返り値変更:
* Time#to_s now returns US-ASCII encoding instead of BINARY.

* TracePoint
* new class. This class is replacement of set_trace_func.
Easy to use and efficient implementation.

* toplevel
* added method:
* added main.define_method whi...
...s doesn't inherit to spawned process unless
explicitly requested such as system(..., fd=>fd).

* Kernel#respond_to? against a protected method now returns false
unless the second argument is true.

* Object#respond_to_missing?, Object#initialize_clone, Object#initialize_dup
* private...

NEWS for Ruby 2.3.0 (36.0)

NEWS for Ruby 2.3.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...ンに --debug または --debug=frozen-string-literal を付けて実行すると、
freeze された文字列を操作しようとして RuntimeError が発生したときにそのオブジェクトが生成された位置を表示します。
11725

* safe navigation operator (ぼ...
...たときに、自動的に他の似た名前を提案してくれます。
//emlist{
"Yuki".starts_with?("Y")
# => NoMethodError: undefined method `starts_with?' for "Yuki":String
# Did you mean? start_with?
//}

* インデントされたヒアドキュメント:
* 新...
...りました。

* 現在日時を timespec 構造体として取得する rb_timespec_now() が追加されました。
11558

* 起算時からの経過秒数、ナノ秒、UTCからの時差から Time オブジェクトを
生成する rb_time_timespec_new() が追加されました...

絞り込み条件を変える

WIN32OLE_TYPE#default_event_sources -> [WIN32OLE_TYPE] (18.0)

型が持つソースインターフェイスを取得します。

...leted
end
source.ole_methods.each do |m|
WebEvent.module_eval do
define
_method("on#{m.name}") do |*arg|
if arg[0] == "ページが表示されました"
@completed = true
end
puts "#{Time.now}: #{m.name} was called"
p arg
end
end
end
evt = WIN...