るりまサーチ

最速Rubyリファレンスマニュアル検索!
212件ヒット [1-100件を表示] (0.121秒)

別のキーワード

  1. socket int
  2. prime int_from_prime_division
  3. _builtin to_int
  4. mkmf convertible_int
  5. option int

ライブラリ

モジュール

キーワード

検索結果

<< 1 2 3 > >>

Fiddle::Importer#struct(signature) -> Class (18126.0)

C の構造体型に対応する Ruby のクラスを構築して返します。

...れを
配列で signature に渡してデータを定義します。例えば C における
struct
timeval {
long tv_sec;
long tv_usec;
};
という構造体型に対応して
Timeval = struct(["long tv_sec", "long tv_usec"])
として構造体に対応するクラスを生成しま...
...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...

TracePoint#instruction_sequence -> RubyVM::InstructionSequence (9201.0)

script_compiledイベント発生時にコンパイルされた RubyVM::InstructionSequenceインスタンスを返します。

...compiledイベント発生時にコンパイルされた
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 '...

Struct#hash -> Integer (9125.0)

self が保持するメンバのハッシュ値を元にして算出した整数を返します。 self が保持するメンバの値が変化すればこのメソッドが返す値も変化します。

...も変化します。

//emlist[例][ruby]{
Dog = Struct.new(:name, :age)
dog = Dog.new("fred", 5)
p dog.hash #=> 7917421
dog.name = "john"
p dog.hash #=> -38913223
//}

[注意] 本メソッドの記述は Struct の下位クラスのインスタンスに対し...
...て呼び
出す事を想定しています。Struct.new は Struct の下位クラスを作成する点に
注意してください。...

Struct#length -> Integer (9125.0)

構造体のメンバの数を返します。

...注意] 本メソッドの記述は Struct の下位クラスのインスタンスに対して呼び
出す事を想定しています。Struct.new は Struct の下位クラスを作成する点に
注意してください。

//emlist[例][ruby]{
Customer = Struct.new(:name, :address, :zip)
joe =...

Struct#size -> Integer (9125.0)

構造体のメンバの数を返します。

...注意] 本メソッドの記述は Struct の下位クラスのインスタンスに対して呼び
出す事を想定しています。Struct.new は Struct の下位クラスを作成する点に
注意してください。

//emlist[例][ruby]{
Customer = Struct.new(:name, :address, :zip)
joe =...

絞り込み条件を変える

Fiddle::CStruct#to_i -> Integer (3101.0)

保持している構造体の先頭アドレスを整数で返します。

保持している構造体の先頭アドレスを整数で返します。

Fiddle::CStruct#to_ptr -> Fiddle::Pointer (3101.0)

保持している構造体へのポインタを返します。

保持している構造体へのポインタを返します。

OpenStruct#hash -> Integer (3101.0)

self のハッシュ値を返します。

self のハッシュ値を返します。

RubyVM::InstructionSequence#first_lineno -> Integer (3101.0)

self が表す命令シーケンスの 1 行目の行番号を返します。

...の 1 行目の行番号を返します。

例1:irb で実行した場合

RubyVM::InstructionSequence.compile('num = 1 + 2').first_lineno
# => 1

例2:

# /tmp/method.rb
require "foo-library"
def foo
p :foo
end

RubyVM::InstructionSequence.of(method(:foo)).first_lineno
# => 2...

RubyVM::InstructionSequence#to_a -> Array (3007.0)

self の情報を 14 要素の配列にして返します。

...ます。

命令シーケンスを以下の情報で表します。

: magic

データフォーマットを示す文字列。常に
"YARVInstructionSequence/SimpleDataFormat"。

: major_version

命令シーケンスのメジャーバージョン。

: minor_version

命令シーケンス...
...とオペランドの配列の配列。


//emlist[例][ruby]{
require 'pp'

iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
pp iseq.to_a
# ※ Ruby 2.5.0 での実行結果
# => ["YARVInstructionSequence/SimpleDataFormat",
# 2,
# 0,
# 1,
# {:arg_size=>0, :local_size=>2, :stack_max=>2},
#...
..."<compiled>",
# "<compiled>",
# nil,
# 1,
# :top,
# [:num],
# 0,
# [],
# [1,
# [:trace, 1],
# [:putobject_OP_INT2FIX_O_1_C_],
# [:putobject, 2],
# [:opt_plus, {:mid=>:+, :flag=>256, :orig_argc=>1, :blockptr=>nil}],
# [:dup],
# [:setlocal_OP__WC__0, 2],
# [:leave]]]
//}...

絞り込み条件を変える

<< 1 2 3 > >>