るりまサーチ

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

別のキーワード

  1. openssl p
  2. openssl p=
  3. fileutils mkdir_p
  4. dh p
  5. kernel p

ライブラリ

クラス

キーワード

検索結果

Gem::SpecFetcher.fetcher -> Gem::SpecFetcher (24302.0)

このクラスの唯一のインスタンスを返します。

このクラスの唯一のインスタンスを返します。

Gem::SpecFetcher.fetcher=(fetcher) (12203.0)

@todo

@todo

Data.define(*args) -> Class (55.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)
f...
...lass 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)
fetcher
= HTTPFetcher.new
c...
...ase fetcher.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 (55.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)
f...
...lass 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)
fetcher
= HTTPFetcher.new
c...
...ase fetcher.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 値オブジェクトのクラス...