るりまサーチ

最速Rubyリファレンスマニュアル検索!
464件ヒット [401-464件を表示] (0.108秒)
トップページ > クエリ:t[x] > クエリ:method[x] > クラス:Module[x]

別のキーワード

  1. openssl t61string
  2. asn1 t61string
  3. matrix t
  4. t61string new
  5. fiddle type_size_t

検索結果

<< < ... 3 4 5 >>

Module#private(names) -> Array (6107.0)

メソッドを private に設定します。

...メソッドを private に設定します。

引数なしのときは今後このクラスまたはモジュール定義内で新規に定義さ
れるメソッドを関数形式でだけ呼び出せるように(private)設定します。

引数が与えられた時には引数によって指定...
...されたメソッドを private に
設定します。

可視性については d:spec/def#limit を参照して下さい。

@param name 0 個以上の String または Symbol を指定します。
@param names 0 個以上の String または Symbol を Array で指定します。

@raise NameEr...
...

//emlist[例][ruby]{
class Foo
def foo1() 1 end # デフォルトでは public
private # 可視性を private に変更
def foo2() 2 end # foo2 は private メソッド
end

foo = Foo.new
p foo.foo1 # => 1
p foo.foo2 # => private method `foo2' cal...

Module#ruby2_keywords(method_name, ...) -> nil (344.0)

For the given method names, marks the method as passing keywords through a normal argument splat. This should only be called on methods that accept an argument splat (`*args`) but not explicit keywords or a keyword splat. It marks the method such that if the method is called with keyword arguments, the final hash argument is marked with a special flag such that if it is the final element of a normal argument splat to another method call, and that method call does not include explicit keywords or a keyword splat, the final element is interpreted as keywords. In other words, keywords will be passed through the method to other methods.

... the given method names, marks the method as passing keywords through
a normal argument splat. This should only be called on methods that
accept an argument splat (`*args`) but not explicit keywords or a
keyword splat. It marks the method such that if the method is called
with keyword arguments, t...
...t is marked with a special
flag such that if it is the final element of a normal argument splat to
another method call, and that method call does not include explicit
keywords or a keyword splat, the final element is interpreted as
keywords. In other words, keywords will be passed through the method...
...d for methods that delegate keywords to another
method
, and only for backwards compatibility with Ruby versions before
2.7.

T
his method will probably be removed at some point, as it exists only
for backwards compatibility. As it does not exist in Ruby versions
before 2.7, check that the module resp...

Module#class_exec(*args) {|*vars| ... } -> object (125.0)

与えられたブロックを指定された args を引数としてモジュールのコンテキストで評価します。

...す。


//emlist[例][ruby]{
class Thing
end
c = 1

T
hing.class_exec{
def hello()
"Hello there!"
end

define_method(:foo) do # ローカル変数がブロックの外側を参照している
c
end
}

t
= Thing.new
p t.hello() #=> "Hello there!"
p t.foo()...
...#=> 1
//}

@see Module#module_eval, Module#class_eval...

Module#module_exec(*args) {|*vars| ... } -> object (125.0)

与えられたブロックを指定された args を引数としてモジュールのコンテキストで評価します。

...す。


//emlist[例][ruby]{
class Thing
end
c = 1

T
hing.class_exec{
def hello()
"Hello there!"
end

define_method(:foo) do # ローカル変数がブロックの外側を参照している
c
end
}

t
= Thing.new
p t.hello() #=> "Hello there!"
p t.foo()...
...#=> 1
//}

@see Module#module_eval, Module#class_eval...

Module#psych_yaml_as(tag) -> () (107.0)

クラスと tag の間を関連付けます。

...クラスと tag の間を関連付けます。

これによって tag 付けされた YAML ドキュメントを Ruby のオブジェクトに
変換したりその逆をしたりすることができます。

この method は deprecated です。 Object.yaml_tag を
かわりに使ってくだ...
...さい。

@param tag 対象のクラスに関連付けるタグの文字列...

絞り込み条件を変える

Module#public(name) -> String | Symbol (107.0)

メソッドを public に設定します。

...f#limit を参照して下さい。

@param name 0 個以上の String または Symbol を指定します。
@param names 0 個以上の String または Symbol を Array で指定します。

@raise NameError 存在しないメソッド名を指定した場合に発生します。

//emlist[例]...
...[ruby]{
def foo() 1 end
p foo # => 1
# the toplevel default is private
p self.foo # => private method `foo' called for #<Object:0x401c83b0> (NoMethodError)

def bar() 2 end
public :bar # visibility changed (all access allowed)
p bar # => 2
p self.bar # =>...

Module#yaml_as(tag) -> () (107.0)

クラスと tag の間を関連付けます。

...クラスと tag の間を関連付けます。

これによって tag 付けされた YAML ドキュメントを Ruby のオブジェクトに
変換したりその逆をしたりすることができます。

この method は deprecated です。 Object.yaml_tag を
かわりに使ってくだ...
...さい。

@param tag 対象のクラスに関連付けるタグの文字列...
<< < ... 3 4 5 >>