種類
- インスタンスメソッド (137)
- 特異メソッド (83)
- 定数 (66)
- ライブラリ (33)
- 文書 (25)
クラス
- Array (19)
- Data (8)
-
Net
:: IMAP :: Envelope (22) -
Net
:: SMTP (28) -
Resolv
:: DNS :: Resource :: IN :: WKS (11) - Socket (33)
- String (11)
- Struct (121)
モジュール
-
Socket
:: Constants (33)
キーワード
-
AI
_ PASSIVE (22) -
INADDR
_ ANY (22) -
IP
_ ONESBCAST (22) -
NEWS for Ruby 3
. 1 . 0 (3) - [] (11)
- deconstruct (5)
- each (11)
- inspect (13)
-
net
/ smtp (11) - new (44)
- pack (19)
- pack テンプレート文字列 (11)
- rdoc (11)
-
reply
_ to (11) - resolv (11)
-
ruby 1
. 6 feature (11) - start (28)
-
to
_ a (11) -
to
_ h (21) -
to
_ s (13) - unpack (11)
- values (11)
検索結果
先頭5件
-
Socket
:: Constants :: AI _ PASSIVE -> Integer (132.0) -
Get address to use with bind。
...Get address to use with bind。
Socket.getaddrinfo, Addrinfo.getaddrinfo の引数 flags に渡す
定数です。
@see getaddrinfo(3)... -
Socket
:: Constants :: INADDR _ ANY -> Integer (132.0) -
A socket bound to INADDR_ANY receives packets from all interfaces and sends from the default IP address。 IPv4アドレスの 0.0.0.0 に対応する整数です。
...A socket bound to INADDR_ANY receives packets from
all interfaces and sends from the default IP address。
IPv4アドレスの 0.0.0.0 に対応する整数です。
@see netinet/in.h(header), ip(7linux), ip(4freebsd)... -
Socket
:: Constants :: IP _ ONESBCAST -> Integer (132.0) -
Force outgoing broadcast datagrams to have the undirected broadcast address。 BasicSocket#getsockopt, BasicSocket#setsockopt の第2引数(optname)に使用します。
...Force outgoing broadcast datagrams to have the undirected broadcast address。
BasicSocket#getsockopt, BasicSocket#setsockopt
の第2引数(optname)に使用します。
@see Socket::Constants::IPPROTO_IP, ip(4freebsd)... -
Socket
:: INADDR _ ANY -> Integer (132.0) -
A socket bound to INADDR_ANY receives packets from all interfaces and sends from the default IP address。 IPv4アドレスの 0.0.0.0 に対応する整数です。
...A socket bound to INADDR_ANY receives packets from
all interfaces and sends from the default IP address。
IPv4アドレスの 0.0.0.0 に対応する整数です。
@see netinet/in.h(header), ip(7linux), ip(4freebsd)... -
Socket
:: IP _ ONESBCAST -> Integer (132.0) -
Force outgoing broadcast datagrams to have the undirected broadcast address。 BasicSocket#getsockopt, BasicSocket#setsockopt の第2引数(optname)に使用します。
...Force outgoing broadcast datagrams to have the undirected broadcast address。
BasicSocket#getsockopt, BasicSocket#setsockopt
の第2引数(optname)に使用します。
@see Socket::Constants::IPPROTO_IP, ip(4freebsd)... -
Struct
. new(*args , keyword _ init: nil) -> Class (118.0) -
Struct クラスに新しいサブクラスを作って、それを返します。
...ct.new(:x, :y)
Point.new(x: 1, y: 2) # => #<struct Point x={:x=>1, :y=>2}, y=nil>
# warning: Passing only keyword arguments to Struct#initialize will behave differently from Ruby 3.2. Please use a Hash literal like .new({k: v}) instead of .new(k: v).
# keyword_init: false......以下のような指定はエラーになります。
//emlist[例][ruby]{
p Struct.new('foo', 'bar')
# => -:1:in `new': identifier foo needs to be constant (NameError)
//}
また args[1..-1] は、Symbol か String で指定します。
//emlist[例][ruby]{
p Struct.new("Foo", :foo, :bar) # =......、定義した Struct はブロックパラメータにも渡さ
れます。
//emlist[例][ruby]{
Customer = Struct.new(:name, :address) do
def greeting
"Hello #{name}!"
end
end
Customer.new("Dave", "123 Main").greeting # => "Hello Dave!"
//}
Structをカスタマイズする場合はこ... -
Struct
. new(*args , keyword _ init: nil) {|subclass| block } -> Class (118.0) -
Struct クラスに新しいサブクラスを作って、それを返します。
...ct.new(:x, :y)
Point.new(x: 1, y: 2) # => #<struct Point x={:x=>1, :y=>2}, y=nil>
# warning: Passing only keyword arguments to Struct#initialize will behave differently from Ruby 3.2. Please use a Hash literal like .new({k: v}) instead of .new(k: v).
# keyword_init: false......以下のような指定はエラーになります。
//emlist[例][ruby]{
p Struct.new('foo', 'bar')
# => -:1:in `new': identifier foo needs to be constant (NameError)
//}
また args[1..-1] は、Symbol か String で指定します。
//emlist[例][ruby]{
p Struct.new("Foo", :foo, :bar) # =......、定義した Struct はブロックパラメータにも渡さ
れます。
//emlist[例][ruby]{
Customer = Struct.new(:name, :address) do
def greeting
"Hello #{name}!"
end
end
Customer.new("Dave", "123 Main").greeting # => "Hello Dave!"
//}
Structをカスタマイズする場合はこ... -
Data
# inspect -> String (113.0) -
self の内容を人間に読みやすい文字列にして返します。
...字列にして返します。
//emlist[例][ruby]{
Customer = Data.define(:name, :address, :zip)
joe = Customer.new("Joe Smith", "123 Maple, Anytown NC", 12345)
joe.inspect # => "#<data Customer name=\"Joe Smith\", address=\"123 Maple, Anytown NC\", zip=12345>"
//}
[注意] 本メソッドの記... -
Struct
# deconstruct -> [object] (113.0) -
構造体のメンバの値を配列にいれて返します。
...のメンバの値を配列にいれて返します。
//emlist[例][ruby]{
Customer = Struct.new(:name, :address, :zip)
Customer.new("Joe Smith", "123 Maple, Anytown NC", 12345).to_a
# => ["Joe Smith", "123 Maple, Anytown NC", 12345]
//}
[注意] 本メソッドの記述は Struct の下位クラ... -
Struct
# inspect -> String (113.0) -
self の内容を人間に読みやすい文字列にして返します。
...クラスを作成する点に
注意してください。
//emlist[例][ruby]{
Customer = Struct.new(:name, :address, :zip)
joe = Customer.new("Joe Smith", "123 Maple, Anytown NC", 12345)
joe.inspect # => "#<struct Customer name=\"Joe Smith\", address=\"123 Maple, Anytown NC\", zip=12345>"
//}... -
Struct
# values -> [object] (113.0) -
構造体のメンバの値を配列にいれて返します。
...のメンバの値を配列にいれて返します。
//emlist[例][ruby]{
Customer = Struct.new(:name, :address, :zip)
Customer.new("Joe Smith", "123 Maple, Anytown NC", 12345).to_a
# => ["Joe Smith", "123 Maple, Anytown NC", 12345]
//}
[注意] 本メソッドの記述は Struct の下位クラ... -
Struct
. new(*args) -> Class (112.0) -
Struct クラスに新しいサブクラスを作って、それを返します。
...以下のような指定はエラーになります。
//emlist[例][ruby]{
p Struct.new('foo', 'bar')
# => -:1:in `new': identifier foo needs to be constant (NameError)
//}
また args[1..-1] は、Symbol か String で指定します。
//emlist[例][ruby]{
p Struct.new("Foo", :foo, :bar) # =......、定義した Struct はブロックパラメータにも渡さ
れます。
//emlist[例][ruby]{
Customer = Struct.new(:name, :address) do
def greeting
"Hello #{name}!"
end
end
Customer.new("Dave", "123 Main").greeting # => "Hello Dave!"
//}
Structをカスタマイズする場合はこ... -
Struct
. new(*args) {|subclass| block } -> Class (112.0) -
Struct クラスに新しいサブクラスを作って、それを返します。
...以下のような指定はエラーになります。
//emlist[例][ruby]{
p Struct.new('foo', 'bar')
# => -:1:in `new': identifier foo needs to be constant (NameError)
//}
また args[1..-1] は、Symbol か String で指定します。
//emlist[例][ruby]{
p Struct.new("Foo", :foo, :bar) # =......、定義した Struct はブロックパラメータにも渡さ
れます。
//emlist[例][ruby]{
Customer = Struct.new(:name, :address) do
def greeting
"Hello #{name}!"
end
end
Customer.new("Dave", "123 Main").greeting # => "Hello Dave!"
//}
Structをカスタマイズする場合はこ... -
Struct
. new(*args , keyword _ init: false) -> Class (112.0) -
Struct クラスに新しいサブクラスを作って、それを返します。
...以下のような指定はエラーになります。
//emlist[例][ruby]{
p Struct.new('foo', 'bar')
# => -:1:in `new': identifier foo needs to be constant (NameError)
//}
また args[1..-1] は、Symbol か String で指定します。
//emlist[例][ruby]{
p Struct.new("Foo", :foo, :bar) # =......、定義した Struct はブロックパラメータにも渡さ
れます。
//emlist[例][ruby]{
Customer = Struct.new(:name, :address) do
def greeting
"Hello #{name}!"
end
end
Customer.new("Dave", "123 Main").greeting # => "Hello Dave!"
//}
Structをカスタマイズする場合はこ... -
Struct
. new(*args , keyword _ init: false) {|subclass| block } -> Class (112.0) -
Struct クラスに新しいサブクラスを作って、それを返します。
...以下のような指定はエラーになります。
//emlist[例][ruby]{
p Struct.new('foo', 'bar')
# => -:1:in `new': identifier foo needs to be constant (NameError)
//}
また args[1..-1] は、Symbol か String で指定します。
//emlist[例][ruby]{
p Struct.new("Foo", :foo, :bar) # =......、定義した Struct はブロックパラメータにも渡さ
れます。
//emlist[例][ruby]{
Customer = Struct.new(:name, :address) do
def greeting
"Hello #{name}!"
end
end
Customer.new("Dave", "123 Main").greeting # => "Hello Dave!"
//}
Structをカスタマイズする場合はこ... -
Struct
. new(*args , keyword _ init: nil) -> Class (112.0) -
Struct クラスに新しいサブクラスを作って、それを返します。
...以下のような指定はエラーになります。
//emlist[例][ruby]{
p Struct.new('foo', 'bar')
# => -:1:in `new': identifier foo needs to be constant (NameError)
//}
また args[1..-1] は、Symbol か String で指定します。
//emlist[例][ruby]{
p Struct.new("Foo", :foo, :bar) # =......、定義した Struct はブロックパラメータにも渡さ
れます。
//emlist[例][ruby]{
Customer = Struct.new(:name, :address) do
def greeting
"Hello #{name}!"
end
end
Customer.new("Dave", "123 Main").greeting # => "Hello Dave!"
//}
Structをカスタマイズする場合はこ... -
Struct
. new(*args , keyword _ init: nil) {|subclass| block } -> Class (112.0) -
Struct クラスに新しいサブクラスを作って、それを返します。
...以下のような指定はエラーになります。
//emlist[例][ruby]{
p Struct.new('foo', 'bar')
# => -:1:in `new': identifier foo needs to be constant (NameError)
//}
また args[1..-1] は、Symbol か String で指定します。
//emlist[例][ruby]{
p Struct.new("Foo", :foo, :bar) # =......、定義した Struct はブロックパラメータにも渡さ
れます。
//emlist[例][ruby]{
Customer = Struct.new(:name, :address) do
def greeting
"Hello #{name}!"
end
end
Customer.new("Dave", "123 Main").greeting # => "Hello Dave!"
//}
Structをカスタマイズする場合はこ...