るりまサーチ

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

別のキーワード

  1. rbconfig ruby
  2. fiddle ruby_free
  3. fiddle build_ruby_platform
  4. rake ruby
  5. rubygems/defaults ruby_engine

ライブラリ

クラス

検索結果

Fiber.current -> Fiber (18126.0)

このメソッドが評価されたコンテキストにおける Fiber のインスタンスを返します。

...のメソッドが評価されたコンテキストにおける Fiber のインスタンスを返します。

//emlist[例:][ruby]{
fr = Fiber.new do
Fiber.current
end

fb = fr.resume
p fb.equal?(fr) # => true

p Fiber.current # => #<Fiber:0x91345e4>
p Fiber.current # => #<Fiber:0x91345e4>
//}...

Data.define(*args) -> Class (43.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",...
...ンマッチに利用できます。

//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
e...
...er.get(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 (43.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",...
...ンマッチに利用できます。

//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
e...
...er.get(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 値オブジェクトのクラスを定義...