276件ヒット
[201-276件を表示]
(0.046秒)
別のキーワード
ライブラリ
- ビルトイン (156)
- delegate (12)
-
fiddle
/ import (12) - forwardable (48)
- json (12)
-
rdoc
/ generator / darkfish (12) -
rdoc
/ generator / ri (12) -
rubygems
/ specification (12)
クラス
- BasicObject (24)
- Class (12)
-
Gem
:: Specification (12) - Object (72)
-
RDoc
:: Generator :: Darkfish (12) -
RDoc
:: Generator :: RI (12) -
Thread
:: Backtrace :: Location (48)
モジュール
-
Fiddle
:: Importer (12) - Forwardable (48)
-
JSON
:: Generator :: GeneratorMethods :: Object (12) - Kernel (12)
キーワード
- DelegateClass (12)
-
_ dump (12) -
absolute
_ path (12) -
base
_ label (12) -
def
_ delegator (12) -
def
_ instance _ delegator (12) - delegate (12)
- inspect (24)
-
instance
_ delegate (12) -
instance
_ exec (12) -
instance
_ variable _ get (12) -
method
_ missing (12) - new (12)
-
singleton
_ method (12) - struct (12)
-
to
_ json (12) -
to
_ s (24) -
yaml
_ initialize (12)
検索結果
先頭5件
-
Thread
:: Backtrace :: Location # to _ s -> String (113.0) -
self が表すフレームを Kernel.#caller と同じ表現にした文字列を返し ます。
...mlist[例][ruby]{
# foo.rb
class Foo
attr_accessor :locations
def initialize(skip)
@locations = caller_locations(skip)
end
end
Foo.new(0..2).locations.map do |call|
puts call.to_s
end
# => path/to/foo.rb:5:in `initialize'
# path/to/foo.rb:9:in `new'
# path/to/foo.rb:9:in `<main>'
//}... -
BasicObject
# instance _ exec(*args) {|*vars| . . . } -> object (107.0) -
与えられたブロックをレシーバのコンテキストで実行します。
...バの持つインスタンス変数にアクセスすることができます。
@param args ブロックパラメータに渡す値です。
//emlist[例][ruby]{
class KlassWithSecret
def initialize
@secret = 99
end
end
k = KlassWithSecret.new
# 以下で x には 5 が渡される
k.ins... -
Fiddle
:: Importer # struct(signature) -> Class (107.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... -
Object
# _ dump(limit) -> String (107.0) -
Marshal.#dump において出力するオブジェクトがメソッド _dump を定義している場合には、そのメソッドの結果が書き出されます。
...。
@return オブジェクトを文字列化したものを返すように定義すべきです。
//emlist[][ruby]{
class Foo
def initialize(arg)
@foo = arg
end
def _dump(limit)
Marshal.dump(@foo, limit)
end
def self._load(obj)
p obj
Foo.new(Marshal.load(obj))
end
end... -
Object
# inspect -> String (107.0) -
オブジェクトを人間が読める形式に変換した文字列を返します。
...変数の名前、値の組を元にした文字列を返します。
//emlist[][ruby]{
class Foo
end
Foo.new.inspect # => "#<Foo:0x0300c868>"
class Bar
def initialize
@bar = 1
end
end
Bar.new.inspect # => "#<Bar:0x0300c868 @bar=1>"
//}
@see Kernel.#p... -
Object
# to _ s -> String (107.0) -
オブジェクトの文字列表現を返します。
...使って文字列に変換し
ます。
//emlist[][ruby]{
class Foo
def initialize num
@num = num
end
end
it = Foo.new(40)
puts it #=> #<Foo:0x2b69110>
class Foo
def to_s
"Class:Foo Number:#{@num}"
end
end
puts it #=> Class:Foo Number:40
//}
@see Object#to_str,Kernel.#String... -
Thread
:: Backtrace :: Location # absolute _ path -> String (107.0) -
self が表すフレームの絶対パスを返します。
...self が表すフレームの絶対パスを返します。
//emlist[例][ruby]{
# foo.rb
class Foo
attr_accessor :locations
def initialize(skip)
@locations = caller_locations(skip)
end
end
Foo.new(0..2).locations.map do |call|
puts call.absolute_path
end
# => /path/to/foo.rb
# /path...