るりまサーチ

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

別のキーワード

  1. module attr
  2. module protected
  3. module private
  4. module public
  5. module constants

検索結果

<< < ... 2 3 4 >>

Object#respond_to?(name, include_all = false) -> bool (18.0)

オブジェクトがメソッド name を持つとき真を返します。

...果を返します。

@param name Symbol または文字列で指定するメソッド名です。

@param include_all private メソッドと protected メソッドを確認の対象に
含めるかを true か false で指定します。省略した場合
...
...o 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
template_method
finish
end

def start
puts "start"
end

def template_method
raise NotImplem...
...生しているが、Rubyによる実装部のため true を返す
puts NotImplTemplateMethod.new.respond_to?(:template_method) # => true
# GNU/Linux で実行。C言語による実装部のため false を返す
puts File.respond_to?(:lchmod) # => false
//}

@see Module#method_defined?...

Object#public_method(name) -> Method (12.0)

オブジェクトの public メソッド name をオブジェクト化した Method オブジェクトを返します。

...@param name メソッド名を Symbol または String で指定します。
@raise NameError 定義されていないメソッド名や、
protected
メソッド名、 private メソッド名を引数として与えると発生します。

//emlist[][ruby]{
1.public_method(:to_int) #=> #<...
...Method: Integer#to_int>
1.public_method(:p) # method `p' for class `Integer' is private (NameError)
//}

@see Object#method,Object#public_send,Module#public_instance_method...
<< < ... 2 3 4 >>