91件ヒット
[1-91件を表示]
(0.100秒)
別のキーワード
クラス
- BasicObject (12)
- Object (24)
- Proc (12)
-
RubyVM
:: InstructionSequence (24) - TracePoint (7)
-
WIN32OLE
_ TYPE (12)
キーワード
-
default
_ event _ sources (12) -
instruction
_ sequence (7) -
respond
_ to? (12) -
singleton
_ method (12) -
singleton
_ method _ undefined (12) -
source
_ location (12) -
to
_ a (12)
検索結果
先頭5件
-
RubyVM
:: InstructionSequence # eval -> object (47208.0) -
self の命令シーケンスを評価してその結果を返します。
...self の命令シーケンスを評価してその結果を返します。
RubyVM::InstructionSequence.compile("1 + 2").eval # => 3... -
RubyVM
:: InstructionSequence # to _ a -> Array (29131.0) -
self の情報を 14 要素の配列にして返します。
...。
: magic
データフォーマットを示す文字列。常に
"YARVInstructionSequence/SimpleDataFormat"。
: major_version
命令シーケンスのメジャーバージョン。
: minor_version
命令シーケンスのマイナーバージョン。
: format_type
データフ......:eval、:main、
:defined_guard のいずれか。
: locals
全ての引数名、ローカル変数名からなる Symbol の配列。
: args
引数の指定が必須のメソッド、ブロックの引数の個数。あるいは以下のよう
な配列。
[required_argc, [optional......構成する命令とオペランドの配列の配列。
//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,... -
TracePoint
# instruction _ sequence -> RubyVM :: InstructionSequence (6525.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 R... -
Object
# respond _ to?(name , include _ all = false) -> bool (6255.0) -
オブジェクトがメソッド name を持つとき真を返します。
...
Rubyの組み込みライブラリや標準ライブラリなど、C言語で実装されているメソッドのみです。
Rubyで実装されたメソッドで NotImplementedError が発生する場合は true を返します。
メソッドが定義されていない場合は、Object#respond......mlist[][ruby]{
class F
def hello
"Bonjour"
end
end
class D
private
def hello
"Guten Tag"
end
end
list = [F.new,D.new]
list.each{|it| puts it.hello if it.respond_to?(:hello)}
#=> Bonjour
list.each{|it| it.instance_eval("puts hello if it.respond_to?(:hello, true)")}
#=> Bonjour
#......espond_to?(:template_method) # => true
# NotImplementedError が発生しているが、Rubyによる実装部のため true を返す
puts NotImplTemplateMethod.new.respond_to?(:template_method) # => true
# GNU/Linux で実行。C言語による実装部のため false を返す
puts File.respond_t... -
Proc
# source _ location -> [String , Integer] | nil (6237.0) -
ソースコードのファイル名と行番号を配列で返します。
...が ruby で定義されていない(つまりネイティブ
である)場合は nil を返します。
//emlist[例][ruby]{
# /path/to/target.rb を実行
proc {}.source_location # => ["/path/to/target.rb", 1]
proc {}.source_location # => ["/path/to/target.rb", 2]
(eval "pr......oc {}").source_location # => ["(eval)", 1]
method(:p).to_proc.source_location # => nil
//}
@see Method#source_location... -
BasicObject
# singleton _ method _ undefined(name) -> object (6219.0) -
特異メソッドが Module#undef_method または undef により未定義にされた時にインタプリタから呼び出されます。
...例][ruby]{
class Foo
def singleton_method_undefined(name)
puts "singleton method \"#{name}\" was undefined"
end
end
obj = Foo.new
def obj.foo
end
def obj.bar
end
class << obj
undef_method :foo
end
obj.instance_eval {undef bar}
#=> singleton method "foo" was undefined
# singleton meth......od "bar" was undefined
//}
@see Module#method_undefined,BasicObject#singleton_method_added,BasicObject#singleton_method_removed , d:spec/def#undef... -
Object
# singleton _ method(name) -> Method (6219.0) -
オブジェクトの特異メソッド name をオブジェクト化した Method オブ ジェクトを返します。
...//emlist[][ruby]{
class Demo
def initialize(n)
@iv = n
end
def hello()
"Hello, @iv = #{@iv}"
end
end
k = Demo.new(99)
def k.hi
"Hi, @iv = #{@iv}"
end
m = k.singleton_method(:hi) # => #<Method: #<Demo:0xf8b0c3c4 @iv=99>.hi>
m.call #=> "Hi, @iv = 99"
m = k.singleton_method(:he......llo) # => NameError
//}
@see Module#instance_method, Method, BasicObject#__send__, Object#send, Kernel.#eval, Object#method... -
WIN32OLE
_ TYPE # default _ event _ sources -> [WIN32OLE _ TYPE] (479.0) -
型が持つソースインターフェイスを取得します。
...Internet Controls', 'InternetExplorer')
ctl = WIN32OLE.new(type.progid)
source = type.default_event_sources[0]
class WebEvent
def initialize
@completed = false
end
attr_reader :completed
end
source.ole_methods.each do |m|
WebEvent.module_eval do
define_method("on#{m.name}"......w.ruby-lang.org/'
loop do
break if evt.handler.completed
WIN32OLE_EVENT.message_loop
end
ctl.Quit
このプログラムを実行するとWindows7のIE8環境では以下のような出力を得られ
ます。
2010-10-06 22:33:54 +0900: PropertyChange was called
["{265b75c1-4158-11d0-90......f6-00c04fd497ea}"]
2010-10-06 22:33:54 +0900: BeforeNavigate2 was called
[#<WIN32OLE:0x9d08f0>, "http://www.ruby-lang.org/", 0, "", nil, "", false]
2010-10-06 22:33:54 +0900: DownloadBegin was called
[]
2010-10-06 22:33:54 +0900: PropertyChange was called
["{D0FCA420-D3F5-11CF-B211-00AA004AE83...