るりまサーチ

最速Rubyリファレンスマニュアル検索!
81件ヒット [1-81件を表示] (0.041秒)

別のキーワード

  1. _builtin private
  2. openssl private?
  3. main private
  4. module private
  5. module private_class_method

検索結果

Object#methods(include_inherited = true) -> [Symbol] (18395.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 prot...
...nd
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
public; def public_singleton()...
...一覧を得る。
p obj.methods(false)
p obj.public_methods(false)
p obj.private_methods(false)
p obj.protected_methods(false)

# 実行結果
[:protected_singleton, :public_singleton]
[:public_singleton, :public_foo]
[:private_singleton, :private_foo]
[:protected_singleton, :protected_foo]
//}


/...

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

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

...メソッドや、
self がクラスの場合はスーパークラスのクラスメソッド(Classのインスタンスの特異メソッド)などです。

singleton
_methods(false) は、Object#methods(false) と同じです。

@param inherited_too 継承した特異メソッドを含める場...
...by]{
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
public;...

1.6.8から1.8.0への変更点(まとめ) (636.0)

1.6.8から1.8.0への変更点(まとめ) * ((<1.6.8から1.8.0への変更点(まとめ)/インタプリタの変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたクラス/モジュール>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたメソッド>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加された定数>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張されたクラス/メソッド(互換性のある変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/変更されたクラス/メソッド(互換性のない変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/文法の変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/正規表現>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Marshal>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Windows 対応>)) * ((<1.6.8から1.8.0への変更点(まとめ)/廃止された(される予定の)機能>)) * ((<1.6.8から1.8.0への変更点(まとめ)/ライブラリ>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張ライブラリAPI>)) * ((<1.6.8から1.8.0への変更点(まとめ)/バグ修正>)) * ((<1.6.8から1.8.0への変更点(まとめ)/サポートプラットフォームの追加>))

...よくわかりません(^^;

class
<< Object
p [self.id, self]
class
<< self
p [self.id, self]
end
end
=> ruby 1.6.7 (2002-03-01) [i586-linux]
[537771634, Class]
[537742484, Class]
=> ruby 1.7.3 (2002-09...
...le#private_method_defined?|Module/private_method_defined?>)) [new]
: ((<Module#protected_method_defined?|Module/protected_method_defined?>)) [new]

: ((<Module#public_method_defined?|Module/public_method_defined?>)) [new]
: ((<Object#methods|Object/methods>)) [change]
: ((<Module#instance_methods|Mo...
... private method になります。

: ((<Object#instance_variable_get|Object/instance_variable_get>)) [new]
: ((<Object#instance_variable_set|Object/instance_variable_set>)) [new]

追加

: ((<Object#object_id|Object/object_id>)) [new]

追加 (Object#id は、obsolete)

: ((<Object#singleton_m...

NEWS for Ruby 3.0.0 (204.0)

NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...C-API methods related to `$SAFE` have been removed.
16131 17136
* yield in singleton class definitions in methods is now a SyntaxError
instead of a warning. yield in a class definition outside of a method
is now a SyntaxError instead of a LocalJumpError. 15575
* When a class varia...
...ble is overtaken by the same definition in an
ancestor class/module, a RuntimeError is now raised (previously,
it only issued a warning in verbose mode). Additionally, accessing a
class
variable from the toplevel scope is now a RuntimeError.
14541
* Assigning to a numbered paramet...
...ct classes and modules that have already included or prepended the receiver, mirroring the behavior if the arguments were included in the receiver before the other modules and classes included or prepended the receiver. 9573
* Module#public, Module#protected, Module#private, Module#public_class_...

Ruby用語集 (138.0)

Ruby用語集 A B C D E F G I J M N O R S Y

...

https://mruby.org/

: main
トップレベルにおける self。Object クラスのインスタンスである。

===[a:N] N

: nil
NilClass の唯一のインスタンス。また、そのオブジェクトを指す擬似変数の名前。
論理値としては偽である。

Ruby...
...ドの)
: method visibility
メソッドの呼び出し可能性。Ruby のメソッド可視性は public、private、protected の
三種類があるが、Java における private、protected とは全く異なるので注意が
必要である。

参照:d:spec/def#limit

: 型
: typ...
...一性

: 特異クラス
: singleton class
すべてのオブジェクトには自身が属すクラスとは別に、オブジェクト固有の
クラスがあり、特異クラスと呼ばれる。

参照:Object#singleton_class

: 特異メソッド
: singleton method
オブジェク...

絞り込み条件を変える

Object#initialize_copy(obj) -> object (66.0)

(拡張ライブラリによる) ユーザ定義クラスのオブジェクトコピーの初期化メソッド。

...および型のチェックを行い self
を返すだけのメソッドです。

initialize_copy という名前のメソッドは
自動的に private に設定されます。

@raise TypeError レシーバが freeze されているか、obj のクラスがレシーバ
のクラスと異なる...
...るかを示します。

obj.dup は、新たに生成したオブジェクトに対して
initialize_copy を呼び

//emlist[][ruby]{
obj2 = obj.class.allocate
obj2.initialize_copy(obj)
//}

obj2 に対してさらに obj の汚染状態、インスタンス変数、ファイナライザを
...
...ーも行います。

//emlist[][ruby]{
obj = Object.new
class
<<obj
attr_accessor :foo
def bar
:bar
end
end

def check(obj)
puts "instance variables: #{obj.inspect}"
puts "tainted?: #{obj.tainted?}"
print "singleton methods: "
begin
p obj.bar
rescue NameError
p $!
end...
...j.class.allocate
obj2.initialize_copy(obj)
//}

obj2 に対してさらに obj のインスタンス変数、ファイナライザを
コピーすることで複製を作ります。 obj.clone は、さらに
特異メソッドのコピーも行います。

//emlist[][ruby]{
obj = Object.new
class
...
...ce variables: #{obj.inspect}"
print "singleton methods: "
begin
p obj.bar
rescue NameError
p $!
end
end

obj.foo = 1

check Object.new.send(:initialize_copy, obj)
#=> instance variables: #<Object:0x4019c9d4>
# singleton methods: #<NoMethodError: ...>
check obj.dup...

NEWS for Ruby 2.0.0 (54.0)

NEWS for Ruby 2.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...' で始まる使用されていない変数は警告しなくなりました

=== 組み込みクラスの更新

* ARGF.class
* 追加: ARGF.class#codepoints, ARGF.class#each_codepoint
IO にある同名のメソッドに対応します

* Array
* 追加: Array#bsearch 二分探...
...た名前がスレッドローカルな変数であるかどうか返します
* 追加: Thread.handle_interrupt as well as instance and singleton methods
Thread.pending_interrupt? for asynchronous handling of exceptions
* 追加: Thread#backtrace_locations Kernel#caller_locations に...
...od now returns false
unless the second argument is true.

* Object#respond_to_missing?, Object#initialize_clone, Object#initialize_dup
* private になりました

* Thread#join, Thread#value
* 上を参照

* Mutex#lock, Mutex#unlock, Mutex#try_lock, Mutex#synchronize, Mutex#slee...

irb/completion (48.0)

irb の completion 機能を提供するライブラリです。

...otected_methods
foo.=== foo.hash foo.public_methods
foo.=~ foo.id foo.respond_to?
foo.__id__ foo.inspect foo.send
foo.__send__ foo.instance_eval foo.singleton_methods
foo.class...
...foo.to_a
foo.dup foo.kind_of? foo.to_s
foo.eql? foo.method foo.type
foo.equal? foo.methods foo.untaint
foo.extend foo.nil?
foo.freeze foo.private_methods...