823件ヒット
[1-100件を表示]
(0.150秒)
ライブラリ
- ビルトイン (280)
- csv (33)
-
fiddle
/ import (88) -
json
/ add / ostruct (11) -
json
/ add / struct (11) - mkmf (22)
- openssl (33)
- ostruct (158)
- rake (11)
-
rexml
/ document (88) -
rexml
/ parsers / pullparser (11) -
rexml
/ sax2listener (11) -
rexml
/ streamlistener (11) - socket (55)
クラス
- Addrinfo (22)
- Array (28)
- CSV (33)
- Data (4)
-
Fiddle
:: CStruct (22) - Hash (9)
-
OpenSSL
:: ASN1 :: Constructive (33) - OpenStruct (169)
-
REXML
:: Element (11) -
REXML
:: Instruction (77) -
REXML
:: Parsers :: PullEvent (11) -
Rake
:: Application (11) -
RubyVM
:: InstructionSequence (119) -
Socket
:: Option (33) - String (11)
- Struct (114)
- TracePoint (6)
モジュール
-
Fiddle
:: Importer (66) - Kernel (22)
-
REXML
:: SAX2Listener (11) -
REXML
:: StreamListener (11)
キーワード
- == (22)
- [] (11)
- []= (11)
-
absolute
_ path (11) -
base
_ label (11) - clone (11)
- content (11)
- content= (11)
- convert (33)
-
create
_ value (11) - data (11)
- deconstruct (2)
-
deconstruct
_ keys (2) -
delete
_ field (11) - dig (36)
- disasm (11)
- disassemble (11)
- each (22)
-
each
_ pair (33) - eql? (11)
- eval (11)
- filter (6)
-
first
_ lineno (11) - hash (22)
-
have
_ struct _ member (22) - inspect (33)
- instruction (11)
- instruction? (11)
-
instruction
_ sequence (6) - instructions (11)
- label (11)
- length (11)
- linger (11)
- modifiable (11)
-
new
_ ostruct _ member (11) -
node
_ type (11) - pack (19)
- path (11)
-
processing
_ instruction (11) - select (11)
- size (11)
- sizeof (11)
- tagging (11)
- tagging= (11)
- target (11)
- target= (11)
-
to
_ a (11) -
to
_ binary (9) -
to
_ h (17) -
to
_ i (11) -
to
_ json (22) -
to
_ ptr (11) -
to
_ s (44) -
to
_ sockaddr (11) - typealias (11)
- union (11)
- unpack (11)
- value (11)
検索結果
先頭5件
-
Fiddle
:: Importer # struct(signature) -> Class (18220.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... -
REXML
:: Element # instructions -> [REXML :: Instraction] (15401.0) -
すべての instruction 子ノードの配列を返します。
...すべての instruction 子ノードの配列を返します。
返される配列は freeze されます。... -
OpenStruct
# new _ ostruct _ member(name) -> Symbol (15201.0) -
与えられた名前のアクセサメソッドを自身に定義します。
...与えられた名前のアクセサメソッドを自身に定義します。
@param name 文字列かシンボルで定義するアクセサの名前を指定します。... -
Struct
# inspect -> String (15131.0) -
self の内容を人間に読みやすい文字列にして返します。
...の記述は Struct の下位クラスのインスタンスに対して呼び
出す事を想定しています。Struct.new は Struct の下位クラスを作成する点に
注意してください。
//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
# length -> Integer (15125.0) -
構造体のメンバの数を返します。
...の記述は Struct の下位クラスのインスタンスに対して呼び
出す事を想定しています。Struct.new は Struct の下位クラスを作成する点に
注意してください。
//emlist[例][ruby]{
Customer = Struct.new(:name, :address, :zip)
joe = Customer.new("Joe Smith......", "123 Maple, Anytown NC", 12345)
joe.length #=> 3
//}... -
Struct
# to _ json(*args) -> String (15107.0) -
自身を JSON 形式の文字列に変換して返します。
...身を JSON 形式の文字列に変換して返します。
内部的にはハッシュにデータをセットしてから JSON::Generator::GeneratorMethods::Hash#to_json を呼び出しています。
@param args 引数はそのまま JSON::Generator::GeneratorMethods::Hash#to_json に渡され......ます。
//emlist[例][ruby]{
require "json/add/core"
Person = Struct.new(:name, :age)
Person.new("tanaka", 29).to_json # => "{\"json_class\":\"Person\",\"v\":[\"tanaka\",29]}"
//}
@see JSON::Generator::GeneratorMethods::Hash#to_json... -
RubyVM
:: InstructionSequence # inspect -> String (15101.0) -
self の情報をラベルとパスを含んだ人間に読みやすい文字列にして返します。
...んだ人間に読みやすい文字列にして返します。
//emlist[例][ruby]{
iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
iseq.inspect # => "<RubyVM::InstructionSequence:<compiled>@<compiled>>"
//}
@see RubyVM::InstructionSequence#label,
RubyVM::InstructionSequence#path... -
TracePoint
# instruction _ sequence -> RubyVM :: InstructionSequence (12501.0) -
script_compiledイベント発生時にコンパイルされた RubyVM::InstructionSequenceインスタンスを返します。
...された
RubyVM::InstructionSequenceインスタンスを返します。
//emlist[例][ruby]{
TracePoint.new(:script_compiled) do |tp|
p tp.instruction_sequence # => <RubyVM::InstructionSequence:block in <main>@(eval):1>
end.enable do
eval("puts 'hello'")
end
//}
@raise RuntimeError :script_c... -
REXML
:: StreamListener # instruction(name , instruction) -> () (12401.0) -
XML処理命令(PI)をパースしたときに呼び出されるコールバックメソッドです。
...ソッドです。
@param name ターゲット名が文字列で渡されます
@param instruction 処理命令の内容が文字列で渡されます
=== 例
<?xml-stylesheet type="text/css" href="style.css"?>
というPIに対し
name: "xml-stylesheet"
instruction: " type=\"text/css\" href... -
Data
# deconstruct -> array (12225.0) -
self のメンバの値を配列で返します。
...define(:amount, :unit)
distance = Measure.new(10, 'km')
distance.deconstruct # => [10, "km"]
//}
このメソッドは以下のようにパターンマッチで利用されます。
//emlist[例][ruby]{
Measure = Data.define(:amount, :unit)
distance = Measure.new(10, 'km')
case distance
in n, 'k......m' # 裏側で #deconstruct を呼ぶ
puts "It is #{n} kilometers away"
else
puts "Don't know how to handle it"
end
# "It is 10 kilometers away" が表示される
# 以下のようにも書ける
case distance
in Measure(n, 'km')
puts "It is #{n} kilometers away"
# ...
end
//}
[注意] 本......メソッドの記述は Data のサブクラスのインスタンスに対して呼び
出す事を想定しています。Data.define は Data のサブクラスを作成する点に
注意してください。... -
Data
# deconstruct _ keys(array _ of _ names _ or _ nil) -> hash (12201.0) -
self のメンバの名前と値の組を Hash で返します。
...Hash で返します。
//emlist[例][ruby]{
Measure = Data.define(:amount, :unit)
distance = Measure.new(10, 'km')
distance.deconstruct_keys(nil) # => {:amount=>10, :unit=>"km"}
distance.deconstruct_keys([:amount]) # => {:amount=>10}
//}
このメソッドは以下のようにパターン......//emlist[例][ruby]{
Measure = Data.define(:amount, :unit)
distance = Measure.new(10, 'km')
case distance
in amount:, unit: 'km' # 裏側で #deconstruct_keys を呼ぶ
puts "It is #{amount} kilometers away"
else
puts "Don't know how to handle it"
end
# "It is 10 kilometers away" が表示さ......れる
# 以下のようにも書ける
case distance
in Measure(amount:, unit: 'km')
puts "It is #{amount} kilometers away"
# ...
end
//}
@param array_of_names_or_nil 返り値に含めるメンバの名前の配列を指定します。nil の場合は全てのメンバを意味します。
[... -
REXML
:: Instruction # content -> String | nil (12201.0) -
XML 処理命令の内容を返します。
...][ruby]{
require 'rexml/document'
doc = REXML::Document.new(<<EOS)
<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/css" href="style.css"?>
<?foobar?>
<root />
EOS
doc[2] # => <?p-i xml-stylesheet ...?>
doc[2].target # => "xml-stylesheet"
doc[2].content # => "type=\"text/css\" hre......f=\"style.css\""
doc[4].target # => "foobar"
doc[4].content # => nil
//}...