種類
ライブラリ
- ビルトイン (776)
- csv (42)
- date (4)
- etc (30)
-
fiddle
/ import (144) - json (12)
-
json
/ add / ostruct (24) -
json
/ add / struct (24) - mkmf (24)
- objspace (12)
- openssl (60)
- ostruct (209)
- rake (12)
-
rexml
/ document (120) -
rexml
/ parsers / pullparser (12) -
rexml
/ sax2listener (12) -
rexml
/ streamlistener (12) - socket (84)
- zlib (12)
クラス
- Addrinfo (36)
- Array (31)
- CSV (36)
-
CSV
:: Row (6) - Data (6)
- Date (2)
- DateTime (2)
-
Fiddle
:: CStruct (60) - Hash (10)
- MatchData (4)
-
OpenSSL
:: ASN1 :: Constructive (36) - OpenStruct (221)
-
REXML
:: Element (12) -
REXML
:: Instruction (96) -
REXML
:: Parsers :: PullEvent (12) -
Rake
:: Application (12) - Range (12)
- RubyVM (12)
-
RubyVM
:: InstructionSequence (246) -
Socket
:: Option (36) - String (12)
- Struct (383)
- Time (2)
- TracePoint (7)
モジュール
- Etc (12)
-
Fiddle
:: Importer (72) - Kernel (24)
- ObjectSpace (60)
-
OpenSSL
:: ASN1 (12) -
REXML
:: SAX2Listener (12) -
REXML
:: StreamListener (12)
キーワード
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (12) - == (36)
- Addrinfo (12)
- CStruct (12)
- CircularDatastructure (12)
- Constructive (12)
-
DATA
_ PTR (12) - Data (3)
-
Data
_ Get _ Struct (12) -
Data
_ Make _ Struct (12) -
Data
_ Wrap _ Struct (12) - Group (9)
-
INSTRUCTION
_ NAMES (12) - InspectKey (12)
- Instruction (12)
- InstructionSequence (12)
- Marshal フォーマット (12)
-
NEWS for Ruby 2
. 0 . 0 (12) -
NEWS for Ruby 2
. 2 . 0 (11) -
NEWS for Ruby 2
. 3 . 0 (10) -
NEWS for Ruby 2
. 5 . 0 (8) -
NEWS for Ruby 2
. 6 . 0 (7) -
NEWS for Ruby 2
. 7 . 0 (6) -
NEWS for Ruby 3
. 0 . 0 (5) -
NEWS for Ruby 3
. 1 . 0 (4) - OpenStruct (12)
- Passwd (9)
- RARRAY (12)
- RBASIC (12)
- RBIGNUM (12)
- RCLASS (12)
- RDATA (12)
- RFILE (12)
- RFLOAT (12)
- RHASH (12)
- RMODULE (12)
- ROBJECT (12)
- RREGEXP (12)
- RSTRING (12)
- RSTRUCT (12)
-
RUBY
_ DATA _ FUNC (12) - Ruby用語集 (12)
-
SC
_ THREAD _ DESTRUCTOR _ ITERATIONS (12) - Struct (12)
- ZStream (12)
- [] (36)
- []= (24)
-
absolute
_ path (12) -
base
_ label (12) - bigdecimal (12)
-
blk
_ copy _ prev (12) -
blk
_ free (12) -
blk
_ mark (12) -
blk
_ orphan (12) -
bm
_ mark (12) - clone (12)
- compile (12)
-
compile
_ file (12) -
compile
_ option (12) -
compile
_ option= (12) - content (12)
- content= (12)
- convert (36)
-
count
_ tdata _ objects (12) -
create
_ value (12) - data (12)
- deconstruct (14)
-
deconstruct
_ keys (20) -
delete
_ field (12) - dig (40)
- disasm (24)
- disassemble (24)
-
dyna
_ pop (12) -
dyna
_ push (12) - each (36)
-
each
_ object (48) -
each
_ pair (48) - eql? (24)
- equal? (12)
- eval (12)
-
fc
_ i (12) -
fc
_ path (12) - fiddle (12)
-
fiddle
/ import (12) -
fiddle
/ types (12) - filter (14)
-
first
_ lineno (12) -
frame
_ dup (12) -
gvar
_ i (12) - hash (24)
-
have
_ struct _ member (24) - inspect (36)
- instruction (12)
- instruction? (12)
-
instruction
_ sequence (7) - instructions (12)
-
ivar
_ i (12) -
json
/ add / ostruct (12) -
json
/ add / struct (12) -
json
_ create (24) -
keyword
_ init? (4) - label (12)
- length (12)
- linger (12)
-
load
_ from _ binary (10) -
load
_ from _ binary _ extra _ data (10) - malloc (12)
-
mark
_ global _ entry (12) - members (24)
- modifiable (12)
- new (108)
-
new
_ blktag (12) -
new
_ dvar (12) -
new
_ ostruct _ member (12) -
node
_ type (12) - of (12)
- ostruct (12)
- pack (21)
- pack テンプレート文字列 (12)
- path (12)
-
processing
_ instruction (12) -
rb
_ exec (1) -
rb
_ exec _ arg _ addopt (1) -
rb
_ exec _ arg _ fixup (1) -
rb
_ exec _ arg _ init (1) -
rb
_ exec _ err (1) -
rb
_ gc _ mark _ frame (12) -
rb
_ global _ entry (12) -
rb
_ gvar _ defined (12) -
rb
_ gvar _ get (12) -
rb
_ gvar _ set (12) -
rb
_ reserved _ word (12) -
rb
_ struct _ iv _ get (1) -
rb
_ thread _ select (1) -
rb
_ thread _ wait _ for (12) -
rb
_ time _ timespec _ new (10) -
rb
_ timespec _ now (10) -
remove
_ trace (12) -
rexml
/ document (12) -
ruby 1
. 6 feature (12) -
ruby 1
. 8 . 2 feature (12) -
ruby 1
. 9 feature (12) -
scope
_ dup (12) - select (24)
- size (24)
- sizeof (12)
- socket (12)
-
st
_ init _ table (12) -
st
_ init _ table _ with _ size (12) - tagging (12)
- tagging= (12)
- target (12)
- target= (12)
-
to
_ a (24) -
to
_ binary (10) -
to
_ h (38) -
to
_ i (12) -
to
_ json (24) -
to
_ ptr (12) -
to
_ s (48) -
to
_ sockaddr (12) -
trace
_ en (12) -
trace
_ ev (12) - traverse (12)
- typealias (12)
-
undef
_ setter (12) - union (12)
- unpack (12)
-
val
_ setter (12) - value (12)
- values (12)
-
values
_ at (12) - yaml (12)
-
yaml
/ store (12)
検索結果
先頭5件
-
Fiddle
:: Importer # struct(signature) -> Class (18119.0) -
C の構造体型に対応する Ruby のクラスを構築して返します。
...れを
配列で signature に渡してデータを定義します。例えば C における
struct timeval {
long tv_sec;
long tv_usec;
};
という構造体型に対応して
Timeval = struct(["long tv_sec", "long tv_usec"])
として構造体に対応するクラスを生成しま......* クラスメソッド malloc
* initialize
* to_ptr
* to_i
* 構造体の各メンバへのアクセサ
返されるクラスは Fiddle::CStruct を継承しています。詳しくは
そちらを参照してください。
@param signature 構造体の各要素を文字列で表現し......require 'fiddle/import'
module M
extend Fiddle::Importer
dlload "libc.so.6"
extern "int gettimeofday(void*, void*)"
Timeval = struct(["long tv_sec", "long tv_usec"])
end
time = M::Timeval.malloc
M.gettimeofday(time, Fiddle::NULL)
p time.tv_sec
p time.tv_usec... -
Struct
# deconstruct -> [object] (15124.0) -
構造体のメンバの値を配列にいれて返します。
...= 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 は Struct の下位クラスを作成する点に
注意してください。
@see d:spec/pattern_matching#matching_non_primitive_objects... -
Struct
# deconstruct _ keys(array _ of _ names) -> Hash (15124.0) -
self のメンバの名前と値の組を Hash で返します。
...ustomer = Struct.new(:name, :address, :zip)
joe = Customer.new("Joe Smith", "123 Maple, Anytown NC", 12345)
h = joe.deconstruct_keys([:zip, :address])
h # => {:zip=>12345, :address=>"123 Maple, Anytown NC"}
# 引数が nil の場合は全てのメンバを返します。
h = joe.deconstruct_keys(ni......:address=>"123 Maple, Anytown NC", :zip=>12345}
//}
[注意] 本メソッドの記述は Struct の下位クラスのインスタンスに対して呼び
出す事を想定しています。Struct.new は Struct の下位クラスを作成する点に
注意してください。
@see d:spec/patter... -
Struct
# to _ a -> [object] (12024.0) -
構造体のメンバの値を配列にいれて返します。
...= 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 は Struct の下位クラスを作成する点に
注意してください。
@see d:spec/pattern_matching#matching_non_primitive_objects... -
Struct
# values -> [object] (12024.0) -
構造体のメンバの値を配列にいれて返します。
...= 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 は Struct の下位クラスを作成する点に
注意してください。
@see d:spec/pattern_matching#matching_non_primitive_objects... -
Struct
. new(*args , keyword _ init: nil) -> Class (9200.0) -
Struct クラスに新しいサブクラスを作って、それを返します。
...
Struct クラスに新しいサブクラスを作って、それを返します。
サブクラスでは構造体のメンバに対するアクセスメソッドが定義されています。
//emlist[例][ruby]{
dog = Struct.new("Dog", :name, :age)
fred = dog.new("fred", 5)
fred.age = 6
printf "....../emlist[例][ruby]{
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.n......words: z)
Point2 = 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... -
Struct
. new(*args , keyword _ init: nil) {|subclass| block } -> Class (9200.0) -
Struct クラスに新しいサブクラスを作って、それを返します。
...
Struct クラスに新しいサブクラスを作って、それを返します。
サブクラスでは構造体のメンバに対するアクセスメソッドが定義されています。
//emlist[例][ruby]{
dog = Struct.new("Dog", :name, :age)
fred = dog.new("fred", 5)
fred.age = 6
printf "....../emlist[例][ruby]{
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.n......words: z)
Point2 = 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... -
Struct
. [](*args) -> Struct (9155.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) -> Struct (9155.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
. [](*args) -> Struct (9144.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) -> Struct (9144.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
. [](*args) -> Struct (9139.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) -> Struct (9139.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 , keyword _ init: nil) -> Class (9134.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) # Arg......nknown keywords: z)
//}
//emlist[警告が出る例][ruby]{
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... -
Struct
. new(*args , keyword _ init: nil) {|subclass| block } -> Class (9134.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) # Arg......nknown keywords: z)
//}
//emlist[警告が出る例][ruby]{
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... -
Struct
. new(*args) -> Class (9104.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) # Arg......ます。
//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 (9104.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) # Arg......ます。
//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 (9104.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) # Arg......ます。
//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 (9104.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) # Arg......ます。
//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
. json _ create(hash) -> Struct (9101.0) -
JSON のオブジェクトから Ruby のオブジェクトを生成して返します。
JSON のオブジェクトから Ruby のオブジェクトを生成して返します。
@param hash 適切なキーを持つハッシュを指定します。 -
OpenStruct
# new _ ostruct _ member(name) -> Symbol (9100.0) -
与えられた名前のアクセサメソッドを自身に定義します。
与えられた名前のアクセサメソッドを自身に定義します。
@param name 文字列かシンボルで定義するアクセサの名前を指定します。