38件ヒット
[1-38件を表示]
(0.042秒)
モジュール
検索結果
先頭4件
-
Method
# owner -> Class | Module (18125.0) -
このメソッドが定義されている class か module を返します。
...定義されている class か module を返します。
//emlist[例][ruby]{
class Foo
def foo(arg)
"foo called with arg #{arg}"
end
end
m = Foo.new.method(:foo) # => #<Method: Foo#foo>
m.owner # => Foo
m = Foo.new.method(:puts) # => #<Method: Foo(Kernel)#puts>
m.owner # => Kernel
//}... -
JSON
:: Generator :: GeneratorMethods :: Object # to _ json(state _ or _ hash = nil) -> String (18.0) -
自身を to_s で文字列にした結果を JSON 形式の文字列に変換して返します。
...JSON::State.new の引数と同じ Hash を
指定します。
//emlist[例][ruby]{
require "json"
class Person
attr :name, :age
def initialize(name, age)
@name, @age = name, age
end
end
tanaka = Person.new("tanaka", 29)
tanaka.to_json # => "......\"#<Person:0x00007ffdec0167c8>\""
tanaka.method(:to_json).owner # => JSON::Ext::Generator::GeneratorMethods::Object
//}... -
Monitor
# exit -> () (12.0) -
MonitorMixin#mon_exit の別名です。
...ドが一つ実行を再開します。
@raise ThreadError ロックを持っていないスレッドが呼びだした場合に発生します
//emlist[例][ruby]{
require 'monitor'
mon = Monitor.new
mon.enter
mon.enter
mon.exit
mon.exit
mon.exit # => current thread not owner (ThreadError)
//}... -
Monitor
# mon _ exit -> () (12.0) -
モニターのロックを解放します。
...ドが一つ実行を再開します。
@raise ThreadError ロックを持っていないスレッドが呼びだした場合に発生します
//emlist[例][ruby]{
require 'monitor'
mon = Monitor.new
mon.enter
mon.enter
mon.exit
mon.exit
mon.exit # => current thread not owner (ThreadError)
//}...