るりまサーチ

最速Rubyリファレンスマニュアル検索!
55件ヒット [1-55件を表示] (0.024秒)
トップページ > クラス:Object[x] > クエリ:module[x] > クエリ:private[x]

別のキーワード

  1. module attr
  2. module new
  3. module constants
  4. module class_eval
  5. module module_eval

ライブラリ

キーワード

検索結果

Object#private_methods(include_inherited = true) -> [Symbol] (6130.0)

そのオブジェクトが理解できる private メソッド名の一覧を返します。

...が理解できる private メソッド名の一覧を返します。

@param include_inherited 偽となる値を指定すると自身のクラスのスーパークラスで定義されたメソッドを除きます。


@see Module#private_instance_methods,Object#methods,Object#singleton_methods...

Object#methods(include_inherited = true) -> [Symbol] (91.0)

そのオブジェクトに対して呼び出せるメソッド名の一覧を返します。 このメソッドは public メソッドおよび protected メソッドの名前を返します。

...別に、引数が偽の時は Object#singleton_methods(false) と同じになっています。


@param include_inherited 引数が偽の時は Object#singleton_methods(false) と同じになります。

//emlist[例1][ruby]{
class Parent
private
; def private_parent() end
protected; def p...
...nd
public; def public_parent() end
end

class Foo < Parent
private
; def private_foo() end
protected; def protected_foo() end
public; def public_foo() end
end

obj = Foo.new
class <<obj
private
; def private_singleton() end
protected; def protected_singleton() end...
...ublic_singleton, :protected_foo, :public_foo, :protected_parent, :public_parent]
[:public_singleton, :public_foo, :public_parent]
[:private_singleton, :private_foo, :private_parent]
[:protected_singleton, :protected_foo, :protected_parent]
//}

@see Module#instance_methods,Object#singleton_methods...

Object#singleton_methods(inherited_too = true) -> [Symbol] (55.0)

そのオブジェクトに対して定義されている特異メソッド名 (public あるいは protected メソッド) の一覧を返します。

...た特異メソッドとは Object#extend によって追加された特異メソッドや、
self がクラスの場合はスーパークラスのクラスメソッド(Classのインスタンスの特異メソッド)などです。

singleton_methods(false) は、Object#methods(false) と同じで...
...st[例1][ruby]{
Parent = Class.new

class <<Parent
private
; def private_class_parent() end
protected; def protected_class_parent() end
public; def public_class_parent() end
end

Foo = Class.new(Parent)

class <<Foo
private
; def private_class_foo() end
protected; def protected_class_...
...foo() end
public; def public_class_foo() end
end

module
Bar
private
; def private_bar() end
protected; def protected_bar() end
public; def public_bar() end
end

obj = Foo.new
class <<obj
include Bar
private
; def private_self() end
protected; def protected_self() end...

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

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

...す。

メソッドが定義されていない場合は、Object#respond_to_missing? を呼
び出してその結果を返します。

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

@param include_all private メソッドと protected メソッドを確認の対象...
...jour"
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
# Guten Tag

module
Template
def main...
...生しているが、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 (19.0)

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

...ド名、 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_inst...

絞り込み条件を変える