25件ヒット
[1-25件を表示]
(0.015秒)
別のキーワード
種類
- インスタンスメソッド (13)
- 特異メソッド (12)
ライブラリ
- ビルトイン (12)
-
minitest
/ spec (1) - psych (12)
キーワード
-
must
_ throw (1) -
respond
_ to? (12) -
yaml
_ tag (12)
検索結果
先頭3件
-
Object
. yaml _ tag(tag) -> () (6255.0) -
クラスと tag の間を関連付けます。
...クラスと tag の間を関連付けます。
これによって tag 付けされた YAML ドキュメントを Ruby のオブジェクトに
変換したりその逆をしたりすることができます。
@param tag 対象のクラスに関連付けるタグの文字列
=== Example
requir......nd
# Dumps Ruby object normally
p Psych.dump(Foo.new(3))
# =>
# --- !ruby/object:Foo
# x: 3
# Registers tag with class Foo
Foo.yaml_as("tag:example.com,2013:foo")
# ... and dumps the object of Foo class
Psych.dump(Foo.new(3), STDOUT)
# =>
# --- !<tag:example.com,2013:f......oo>
# x: 3
# Loads the object from the tagged YAML node
p Psych.load(<<EOS)
--- !<tag:example.com,2012:foo>
x: 8
EOS
# => #<Foo:0x0000000130f48 @x=8>... -
Object
# must _ throw(tag) -> true (108.0) -
自身を評価中に、与えられたタグが Kernel.#throw された場合、検査にパスしたことになります。
...自身を評価中に、与えられたタグが Kernel.#throw された場合、検査にパスしたことになります。
@param tag 自身を評価中に Kernel.#throw されるタグを任意のオブジェクトとして指定します。
@raise MiniTest::Assertion 与えられたタグが... -
Object
# respond _ to?(name , include _ all = false) -> bool (13.0) -
オブジェクトがメソッド name を持つとき真を返します。
...されたメソッドで NotImplementedError が発生する場合は true を返します。
メソッドが定義されていない場合は、Object#respond_to_missing? を呼
び出してその結果を返します。
@param name Symbol または文字列で指定するメソッド名です。......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
# Guten Tag
module Template
def main
start
t...