15件ヒット
[1-15件を表示]
(0.169秒)
検索結果
先頭3件
-
Net
:: IMAP # fetch(set , attr) -> [Net :: IMAP :: FetchData] (18377.0) -
FETCH コマンドを送り、メールボックス内のメッセージに 関するデータを取得します。
...
FETCH コマンドを送り、メールボックス内のメッセージに
関するデータを取得します。
Net::IMAP#examine もしくは Net::IMAP#select で
指定したメールボックスを対象とします。
set で対象とするメッセージを指定します。
これには......sequence number、sequence number の配列、もしくは
Range オブジェクトを渡します。
attr には取得するアトリビュートを文字列の配列で渡してください。
指定可能なアトリビュートについては Net::IMAP::FetchData#attr
を見てください。......imap.fetch(6..8, "UID")
#=> [#<Net::IMAP::FetchData seqno=6, attr={"UID"=>98}>, #<Net::IMAP::FetchData seqno=7, attr={"UID"=>99}>, #<Net::IMAP::FetchData seqno=8, attr={"UID"=>100}>]
p imap.fetch(6, "BODY[HEADER.FIELDS (SUBJECT)]")
#=> [#<Net::IMAP::FetchData seqno=6, attr={"BODY[HEADER.FIELD... -
Data
. define(*args) -> Class (148.0) -
Data クラスに新しいサブクラスを作って、それを返します。
...ist[例][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 # => NoMethodError
//}......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)
fetcher = HTTPFetcher.......new
case 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 (148.0) -
Data クラスに新しいサブクラスを作って、それを返します。
...ist[例][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 # => NoMethodError
//}......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)
fetcher = HTTPFetcher.......new
case 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 値オブジェクトの...