ライブラリ
- ビルトイン (443)
- csv (33)
-
fiddle
/ import (22) -
json
/ add / ostruct (11) -
json
/ add / struct (11) - ostruct (103)
-
rexml
/ document (44) - socket (11)
クラス
- Addrinfo (11)
- Array (16)
- CSV (33)
- Data (4)
-
Fiddle
:: CStruct (11) - OpenStruct (103)
-
REXML
:: Instruction (33) - Range (11)
-
RubyVM
:: InstructionSequence (33) - Struct (327)
- TracePoint (6)
モジュール
-
Fiddle
:: Importer (11) - ObjectSpace (44)
キーワード
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (11) - == (11)
- Data (2)
-
Data
_ Make _ Struct (11) -
Data
_ Wrap _ Struct (11) - Instruction (11)
- Marshal フォーマット (11)
-
NEWS for Ruby 2
. 0 . 0 (11) -
NEWS for Ruby 2
. 2 . 0 (10) -
NEWS for Ruby 2
. 3 . 0 (9) -
NEWS for Ruby 2
. 5 . 0 (7) -
NEWS for Ruby 2
. 6 . 0 (6) -
NEWS for Ruby 2
. 7 . 0 (5) -
NEWS for Ruby 3
. 0 . 0 (4) -
NEWS for Ruby 3
. 1 . 0 (3) - OpenStruct (11)
- Ruby用語集 (11)
- Struct (11)
- [] (33)
- []= (22)
- compile (11)
-
compile
_ option= (11) - content (11)
- convert (33)
- deconstruct (2)
-
deconstruct
_ keys (2) - dig (18)
- each (22)
-
each
_ object (44) -
each
_ pair (44) - eql? (11)
- equal? (11)
- fiddle (11)
- filter (12)
- hash (11)
- inspect (11)
-
instruction
_ sequence (6) -
json
_ create (11) -
keyword
_ init? (3) - length (11)
- members (22)
-
new
_ blktag (11) -
new
_ dvar (11) -
new
_ ostruct _ member (11) - pack (16)
-
rb
_ time _ timespec _ new (9) -
rexml
/ document (11) -
ruby 1
. 6 feature (11) -
ruby 1
. 8 . 2 feature (11) -
ruby 1
. 9 feature (11) - select (22)
- size (11)
- target (11)
-
to
_ a (11) -
to
_ h (34) -
to
_ json (11) -
to
_ s (11) - typealias (11)
- values (11)
-
values
_ at (11) - yaml (11)
-
yaml
/ store (11)
検索結果
先頭5件
-
Struct
. new(*args , keyword _ init: nil) -> Class (24515.0) -
Struct クラスに新しいサブクラスを作って、それを返します。
...
Struct クラスに新しいサブクラスを作って、それを返します。
サブクラスでは構造体のメンバに対するアクセスメソッドが定義されています。
//emlist[例][ruby]{
dog = Struct.new("Dog", :name, :age)
fred = dog.new("fred", 5)
fred.age = 6
printf "......by]{
Point1 = Struct.new(:x, :y)
Point1.new(1, 2) # => #<struct Point1 x=1, y=2>
Point1.new(x: 1, y: 2) # => #<struct Point1 x=1, y=2>
Point1.new(x: 1) # => #<struct Point1 x=1, y=nil>
Point1.new(y: 2) # => #<struct Point1 x=nil, y=2>
Point1.new(x: 1, y: 2,......t2 = Struct.new(:x, :y, keyword_init: nil)
Point2.new(1, 2) # => #<struct Point2 x=1, y=2>
Point2.new(x: 1, y: 2) # => #<struct Point2 x=1, y=2>
Point2.new(x: 1) # => #<struct Point2 x=1, y=nil>
Point2.new(y: 2) # => #<struct Point2 x=nil, y=2>
Point2.new(x:... -
Struct
. new(*args , keyword _ init: nil) {|subclass| block } -> Class (24515.0) -
Struct クラスに新しいサブクラスを作って、それを返します。
...
Struct クラスに新しいサブクラスを作って、それを返します。
サブクラスでは構造体のメンバに対するアクセスメソッドが定義されています。
//emlist[例][ruby]{
dog = Struct.new("Dog", :name, :age)
fred = dog.new("fred", 5)
fred.age = 6
printf "......by]{
Point1 = Struct.new(:x, :y)
Point1.new(1, 2) # => #<struct Point1 x=1, y=2>
Point1.new(x: 1, y: 2) # => #<struct Point1 x=1, y=2>
Point1.new(x: 1) # => #<struct Point1 x=1, y=nil>
Point1.new(y: 2) # => #<struct Point1 x=nil, y=2>
Point1.new(x: 1, y: 2,......t2 = Struct.new(:x, :y, keyword_init: nil)
Point2.new(1, 2) # => #<struct Point2 x=1, y=2>
Point2.new(x: 1, y: 2) # => #<struct Point2 x=1, y=2>
Point2.new(x: 1) # => #<struct Point2 x=1, y=nil>
Point2.new(y: 2) # => #<struct Point2 x=nil, y=2>
Point2.new(x:... -
Struct
. new(*args , keyword _ init: nil) -> Class (24365.0) -
Struct クラスに新しいサブクラスを作って、それを返します。
...
Struct クラスに新しいサブクラスを作って、それを返します。
サブクラスでは構造体のメンバに対するアクセスメソッドが定義されています。
//emlist[例][ruby]{
dog = Struct.new("Dog", :name, :age)
fred = dog.new("fred", 5)
fred.age = 6
printf "......//emlist[例][ruby]{
Point = Struct.new(:x, :y, keyword_init: true) # => Point(keyword_init: true)
Point.new(x: 1, y: 2) # => #<struct Point x=1, y=2>
Point.new(x: 1) # => #<struct Point x=1, y=nil>
Point.new(y: 2) # => #<struct Point x=nil, y=2>
Point.new(z: 3) # ArgumentError (......uby]{
Point = Struct.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).
# ke... -
Struct
. new(*args , keyword _ init: nil) {|subclass| block } -> Class (24365.0) -
Struct クラスに新しいサブクラスを作って、それを返します。
...
Struct クラスに新しいサブクラスを作って、それを返します。
サブクラスでは構造体のメンバに対するアクセスメソッドが定義されています。
//emlist[例][ruby]{
dog = Struct.new("Dog", :name, :age)
fred = dog.new("fred", 5)
fred.age = 6
printf "......//emlist[例][ruby]{
Point = Struct.new(:x, :y, keyword_init: true) # => Point(keyword_init: true)
Point.new(x: 1, y: 2) # => #<struct Point x=1, y=2>
Point.new(x: 1) # => #<struct Point x=1, y=nil>
Point.new(y: 2) # => #<struct Point x=nil, y=2>
Point.new(z: 3) # ArgumentError (......uby]{
Point = Struct.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).
# ke... -
Struct
. new(*args) -> Struct (24305.0) -
(このメソッドは Struct の下位クラスにのみ定義されています) 構造体オブジェクトを生成して返します。
...(このメソッドは Struct の下位クラスにのみ定義されています)
構造体オブジェクトを生成して返します。
@param args 構造体の初期値を指定します。メンバの初期値は指定されなければ nil です。
@return 構造体クラスのインス......タンス。
@raise ArgumentError 構造体のメンバの数よりも多くの引数を指定した場合に発生します。
//emlist[例][ruby]{
Foo = Struct.new(:foo, :bar)
foo = Foo.new(1)
p foo.values # => [1, nil]
//}... -
Struct
. new(*args) -> Class (24299.0) -
Struct クラスに新しいサブクラスを作って、それを返します。
...
Struct クラスに新しいサブクラスを作って、それを返します。
サブクラスでは構造体のメンバに対するアクセスメソッドが定義されています。
//emlist[例][ruby]{
dog = Struct.new("Dog", :name, :age)
fred = dog.new("fred", 5)
fred.age = 6
printf "......//emlist[例][ruby]{
Point = Struct.new(:x, :y, keyword_init: true) # => Point(keyword_init: true)
Point.new(x: 1, y: 2) # => #<struct Point x=1, y=2>
Point.new(x: 1) # => #<struct Point x=1, y=nil>
Point.new(y: 2) # => #<struct Point x=nil, y=2>
Point.new(z: 3) # ArgumentError (......ます。
//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::Foo
//}
=== 第一引数が Symbol... -
Struct
. new(*args) {|subclass| block } -> Class (24299.0) -
Struct クラスに新しいサブクラスを作って、それを返します。
...
Struct クラスに新しいサブクラスを作って、それを返します。
サブクラスでは構造体のメンバに対するアクセスメソッドが定義されています。
//emlist[例][ruby]{
dog = Struct.new("Dog", :name, :age)
fred = dog.new("fred", 5)
fred.age = 6
printf "......//emlist[例][ruby]{
Point = Struct.new(:x, :y, keyword_init: true) # => Point(keyword_init: true)
Point.new(x: 1, y: 2) # => #<struct Point x=1, y=2>
Point.new(x: 1) # => #<struct Point x=1, y=nil>
Point.new(y: 2) # => #<struct Point x=nil, y=2>
Point.new(z: 3) # ArgumentError (......ます。
//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::Foo
//}
=== 第一引数が Symbol... -
Struct
. new(*args , keyword _ init: false) -> Class (24299.0) -
Struct クラスに新しいサブクラスを作って、それを返します。
...
Struct クラスに新しいサブクラスを作って、それを返します。
サブクラスでは構造体のメンバに対するアクセスメソッドが定義されています。
//emlist[例][ruby]{
dog = Struct.new("Dog", :name, :age)
fred = dog.new("fred", 5)
fred.age = 6
printf "......//emlist[例][ruby]{
Point = Struct.new(:x, :y, keyword_init: true) # => Point(keyword_init: true)
Point.new(x: 1, y: 2) # => #<struct Point x=1, y=2>
Point.new(x: 1) # => #<struct Point x=1, y=nil>
Point.new(y: 2) # => #<struct Point x=nil, y=2>
Point.new(z: 3) # ArgumentError (......ます。
//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::Foo
//}
=== 第一引数が Symbol... -
Struct
. new(*args , keyword _ init: false) {|subclass| block } -> Class (24299.0) -
Struct クラスに新しいサブクラスを作って、それを返します。
...
Struct クラスに新しいサブクラスを作って、それを返します。
サブクラスでは構造体のメンバに対するアクセスメソッドが定義されています。
//emlist[例][ruby]{
dog = Struct.new("Dog", :name, :age)
fred = dog.new("fred", 5)
fred.age = 6
printf "......//emlist[例][ruby]{
Point = Struct.new(:x, :y, keyword_init: true) # => Point(keyword_init: true)
Point.new(x: 1, y: 2) # => #<struct Point x=1, y=2>
Point.new(x: 1) # => #<struct Point x=1, y=nil>
Point.new(y: 2) # => #<struct Point x=nil, y=2>
Point.new(z: 3) # ArgumentError (......ます。
//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::Foo
//}
=== 第一引数が Symbol... -
Struct
. new(*args) -> Struct (24280.0) -
(このメソッドは Struct の下位クラスにのみ定義されています) 構造体オブジェクトを生成して返します。
...(このメソッドは Struct の下位クラスにのみ定義されています)
構造体オブジェクトを生成して返します。
@param args 構造体の初期値を指定します。メンバの初期値は指定されなければ nil です。
@return 構造体クラスのインス......タンス。
@raise ArgumentError 構造体のメンバの数よりも多くの引数を指定した場合に発生します。
//emlist[例][ruby]{
Foo = Struct.new(:foo, :bar)
foo = Foo.new(1)
p foo.values # => [1, nil]
//}... -
Fiddle
:: CStruct . new(addr) -> Fiddle :: CStruct (21207.0) -
addr のアドレスが指すメモリを構造体のアドレスとみなし、 構造体を作ります。
...addr のアドレスが指すメモリを構造体のアドレスとみなし、
構造体を作ります。
C におけるキャストと似ています。
return (struct foo*)addr;
というコードと対応していると言えます。
@param addr アドレス... -
OpenStruct
. new(hash = nil) -> OpenStruct (21207.0) -
OpenStruct オブジェクトを生成します。
...OpenStruct オブジェクトを生成します。
ハッシュが与えられたとき、それぞれのキーを生成したオブジェクトの要素にし、値をセットします。
@param hash 設定する要素とその値を指定します。
hash には Hash クラスのイン......たは each_pair メソッ
ドを持つオブジェクトを用いる事ができます。
@raise NoMethodError hash のキーが to_sym メソッドを持たないときに発生します。
require 'ostruct'
some1 = OpenStruct.new({:a =>"a",:b =>"b"}) # => #<OpenStruct b="b", a="a">... -
REXML
:: Instruction . new(target , content = nil) -> REXML :: Instruction (21201.0) -
新たな Instruction オブジェクトを生成します。
...新たな Instruction オブジェクトを生成します。
@param target ターゲット
@param content 内容... -
RubyVM
:: InstructionSequence . new(source , file = nil , path = nil , line = 1 , options = nil) -> RubyVM :: InstructionSequence (18201.0) -
引数 source で指定した Ruby のソースコードを元にコンパイル済みの RubyVM::InstructionSequence オブジェクトを作成して返します。
...引数 source で指定した Ruby のソースコードを元にコンパイル済みの
RubyVM::InstructionSequence オブジェクトを作成して返します。
@param source Ruby のソースコードを文字列で指定します。
@param file ファイル名を文字列で指定しま......かで指定します。詳細は
RubyVM::InstructionSequence.compile_option= を参照
してください。
RubyVM::InstructionSequence.compile("a = 1 + 2")
# => <RubyVM::InstructionSequence:<compiled>@<compiled>>
@see RubyVM::InstructionSequence.compile_file... -
Range
. new(first , last , exclude _ end = false) -> Range (18173.0) -
first から last までの範囲オブジェクトを生成して返しま す。
...[例: 整数の範囲オブジェクトの場合][ruby]{
Range.new(1, 10) # => 1..10
Range.new(1, 10, true) # => 1...10
//}
//emlist[例: 日付オブジェクトの範囲オブジェクトの場合][ruby]{
require 'date'
Range.new(Date.today, Date.today >> 1).each {|d| puts d }
# => 2017-09-......y]{
require 'ipaddr'
Range.new(IPAddr.new("192.0.2.1"), IPAddr.new("192.0.2.3")).each {|ip| puts ip}
# => 192.0.2.1
# 192.0.2.2
# 192.0.2.3
//}
//emlist[例: 自作のオブジェクトの場合][ruby]{
MyInteger = Struct.new(:value) do
def succ
self.class.new(value + 1)
end
def <=......>(other)
value <=> other.value
end
def to_s
value.to_s
end
end
Range.new(MyInteger.new(1), MyInteger.new(3)).each {|i| puts i }
# => 1
# 2
# 3
//}... -
Addrinfo
. new(sockaddr , family=Socket :: PF _ UNSPEC , socktype=0 , protocol=0) -> Addrinfo (18107.0) -
新たな Addrinfo オブジェクトを返します。
...新たな Addrinfo オブジェクトを返します。
sockaddr は connect(2) などで使われるパラメータで、
struct sockaddr に対応します。faimily, socktype, protocol
は socket(2) のパラメータに対応します。
sockaddr には文字列もしくは配列を指定し... -
OpenStruct
# new _ ostruct _ member(name) -> Symbol (15201.0) -
与えられた名前のアクセサメソッドを自身に定義します。
与えられた名前のアクセサメソッドを自身に定義します。
@param name 文字列かシンボルで定義するアクセサの名前を指定します。