3076件ヒット
[1-100件を表示]
(0.063秒)
種類
ライブラリ
- ビルトイン (740)
- bigdecimal (12)
-
cgi
/ session (12) - continuation (12)
- coverage (8)
- csv (75)
- delegate (12)
- drb (48)
-
drb
/ extserv (12) -
drb
/ timeridconv (12) - e2mmap (6)
- fileutils (28)
- gdbm (12)
-
io
/ nonblock (12) -
irb
/ context (84) -
irb
/ extend-command (24) - json (372)
- matrix (36)
-
minitest
/ spec (2) -
minitest
/ unit (9) - mkmf (36)
- monitor (48)
-
mutex
_ m (24) -
net
/ imap (36) - objspace (60)
- open-uri (32)
- openssl (60)
- optparse (192)
- pp (24)
- pstore (24)
- psych (48)
- rake (24)
-
rdoc
/ code _ object (24) -
rdoc
/ markup (12) -
rexml
/ document (24) -
ripper
/ filter (36) -
rubygems
/ config _ file (24) -
rubygems
/ specification (24) -
rubygems
/ user _ interaction (12) - sdbm (12)
- set (18)
-
shell
/ process-controller (6) - singleton (24)
- socket (156)
- strscan (12)
- sync (12)
- tempfile (55)
- thread (12)
- timeout (29)
- win32ole (132)
-
yaml
/ dbm (12) - zlib (48)
クラス
- Addrinfo (72)
- Array (25)
- BasicObject (36)
- BigDecimal (12)
-
CGI
:: Session (12) - CSV (72)
-
CSV
:: Row (3) - Coverage (8)
-
DRb
:: DRbIdConv (12) -
DRb
:: DRbServer (12) -
DRb
:: ExtServ (12) -
DRb
:: TimerIdConv (12) - Data (3)
- Delegator (12)
- Fiber (6)
- GDBM (12)
-
Gem
:: ConfigFile (24) -
Gem
:: Specification (24) - Hash (36)
- IO (36)
-
IRB
:: Context (72) - Integer (4)
-
JSON
:: Parser (24) -
JSON
:: State (84) - Matrix (24)
- Module (114)
- Monitor (12)
- Mutex (2)
-
Net
:: IMAP (12) -
Net
:: IMAP :: ResponseCode (12) -
Net
:: IMAP :: UntaggedResponse (12) - Object (204)
-
OpenSSL
:: ASN1 :: ObjectId (24) -
OpenSSL
:: SSL :: SSLContext (12) -
OpenSSL
:: X509 :: StoreContext (12) - OptionParser (144)
-
OptionParser
:: ParseError (12) - PP (24)
- PStore (12)
-
PStore
:: DummyMutex (12) -
RDoc
:: CodeObject (24) -
RDoc
:: Markup (12) -
RDoc
:: Options (12) -
REXML
:: DocType (12) -
REXML
:: Element (12) - Rational (12)
-
Ripper
:: Filter (36) -
RubyVM
:: InstructionSequence (12) - SDBM (12)
- Set (24)
-
Shell
:: ProcessController (6) - Socket (84)
- StopIteration (12)
- String (12)
- StringScanner (12)
- Struct (18)
- Tempfile (55)
- Thread (24)
-
Thread
:: Mutex (10) -
Thread
:: Queue (36) -
Thread
:: SizedQueue (36) - Vector (12)
- WIN32OLE (24)
-
WIN32OLE
_ METHOD (12) -
WIN32OLE
_ PARAM (12) -
WIN32OLE
_ TYPE (48) -
WIN32OLE
_ TYPELIB (36) -
YAML
:: DBM (12) -
Zlib
:: GzipWriter (48)
モジュール
- DRb (24)
- Enumerable (72)
- Exception2MessageMapper (6)
- FileUtils (28)
-
IRB
:: ContextExtender (24) - JSON (180)
-
JSON
:: Generator :: GeneratorMethods :: Object (12) -
JSON
:: Generator :: GeneratorMethods :: String (24) - Kernel (110)
- Marshal (24)
-
MiniTest
:: Assertions (9) - MonitorMixin (24)
-
Mutex
_ m (24) - ObjectSpace (60)
-
OptionParser
:: Arguable (24) - Psych (24)
-
Rake
:: Cloneable (24) - Singleton (12)
-
Sync
_ m (12) - Timeout (21)
- URI (16)
オブジェクト
- ENV (12)
キーワード
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (12) - === (12)
- Arguable (12)
- ConsoleUI (12)
- Context (12)
- Converters (12)
-
DEFAULT
_ PARAMS (12) - Float (7)
- HeaderConverters (12)
- Integer (7)
- JSON (24)
-
MAJOR
_ VERSION (12) -
MINOR
_ VERSION (12) - MonitorMixin (12)
-
NEWS for Ruby 2
. 0 . 0 (12) -
NEWS for Ruby 2
. 4 . 0 (9) -
NEWS for Ruby 2
. 5 . 0 (8) -
NEWS for Ruby 2
. 7 . 0 (6) -
NEWS for Ruby 3
. 0 . 0 (5) - Options (12)
-
RUBY
_ DESCRIPTION (12) -
RUBY
_ ENGINE _ VERSION (10) -
RUBY
_ REVISION (12) -
RUBY
_ VERSION (12) - Rational (12)
- Rubyの起動 (12)
- SSLContext (12)
- Singleton (12)
- Thread (12)
- Version (12)
- [] (48)
-
allocation
_ sourcefile (12) -
allocation
_ sourceline (12) -
arg
_ config (12) -
array
_ attributes (12) -
assert
_ empty (1) -
assert
_ equal (1) -
assert
_ includes (1) -
assert
_ instance _ of (1) -
assert
_ kind _ of (1) -
assert
_ nil (1) -
assert
_ respond _ to (1) -
assert
_ same (1) - callcc (12)
- cd (14)
- chdir (14)
- clone (60)
-
cofactor
_ expansion (12) - component (12)
- config (12)
- connect (36)
-
connect
_ from (24) -
connect
_ nonblock (12) -
connect
_ to (24) -
const
_ defined? (12) -
const
_ get (12) -
const
_ load (12) -
const
_ set (12) -
const
_ source _ location (12) - constants (24)
- context (24)
- convert (12)
-
convertible
_ int (24) - create (22)
-
create
_ id (12) - data (24)
- debug (12)
- deconstruct (12)
-
def
_ extend _ command (12) -
default
_ event _ sources (12) -
default
_ value (12) -
define
_ singleton _ method (24) -
deprecate
_ constant (12) - deq (24)
- detect (24)
- dump (36)
- dup (48)
-
each
_ active _ object (6) - eval (12)
- evaluate (12)
- exit (12)
-
extend
_ object (6) -
fast
_ generate (12) -
fast
_ unparse (12) - fetch (48)
- find (24)
- front (36)
- generate (36)
-
handle
_ interrupt (12) - hash (12)
- helpcontext (24)
-
initialize
_ clone (12) - inspect (12)
-
inspect
_ mode (12) -
install
_ extend _ commands (12) - instance (36)
- intersection (6)
- irb (12)
-
irb
/ completion (12) - json (12)
-
laplace
_ expansion (12) -
last
_ value (12) - load (12)
-
load
_ file (24) -
load
_ file! (12) -
long
_ name (12) - main (12)
-
major
_ version (24) -
minor
_ version (24) -
mon
_ synchronize (18) -
mu
_ pp (1) -
mu
_ synchronize (12) -
must
_ be _ within _ epsilon (1) -
must
_ respond _ to (1) - new (59)
- nonblock (12)
-
object
_ nl (12) -
object
_ nl= (12) -
on
_ XXX (12) -
on
_ default (12) - open (78)
- optional? (12)
- parse (36)
- parse! (12)
- partition (24)
-
pending
_ interrupt? (12) - pop (24)
-
pretty
_ generate (12) -
pretty
_ unparse (12) -
private
_ constant (9) -
psych
_ to _ yaml (12) -
public
_ constant (9) - raise (6)
-
rb
_ define _ class _ under (12) -
rb
_ define _ global _ const (12) -
rb
_ obj _ clone (12) -
rb
_ obj _ singleton _ methods (12) - rdoc (12)
-
read
_ nonblock (12) - register (12)
-
remove
_ const (12) -
respond
_ to? (24) -
respond
_ to _ missing? (12) - responses (12)
- restore (12)
- result (12)
-
ruby 1
. 6 feature (12) -
ruby 1
. 8 . 2 feature (12) -
ruby 1
. 8 . 3 feature (12) -
ruby 1
. 8 . 4 feature (12) -
save
_ exception _ mode (12) - section (12)
- section= (12)
-
set
_ last _ value (12) -
sharing
_ detection (12) -
sharing
_ detection= (12) - shift (24)
-
singleton
_ class (12) -
singleton
_ method (12) -
singleton
_ method _ added (12) -
singleton
_ method _ removed (12) -
singleton
_ method _ undefined (12) -
singleton
_ methods (12) - start (8)
-
sync
_ synchronize (6) - synchronize (60)
- tcp (24)
- timeout (29)
-
to
_ a (6) -
to
_ h (12) -
to
_ hash (12) -
to
_ json (12) -
to
_ json _ raw (12) -
to
_ json _ raw _ object (12) -
to
_ obj (24) -
to
_ yaml (12) -
trace
_ object _ allocations (12) -
trace
_ object _ allocations _ start (12) -
trace
_ object _ allocations _ stop (12) - transaction (12)
- trust= (12)
-
try
_ convert (16) -
udp
_ server _ sockets (48) - union (7)
- unparse (12)
- values (6)
- version (12)
- wrap (24)
-
write
_ nonblock (12) - スレッド (12)
検索結果
先頭5件
-
Object
# initialize _ clone(obj) -> object (27235.0) -
Object#clone がオブジェクトを複製する際に呼び出すメソッドです。
...
Object#clone がオブジェクトを複製する際に呼び出すメソッドです。
デフォルトでは Object#initialize_copy を呼び出します。
initialize_clone という名前のメソッドは自動的に private に設定されます。
@see Object#initialize_copy, Object#initi... -
Object
# clone(freeze: nil) -> object (27208.0) -
オブジェクトの複製を作成して返します。
...て返します。
dup はオブジェクトの内容, taint 情報をコピーし、
clone はそれに加えて freeze, 特異メソッドなどの情報も含めた完全な複製を作成します。
clone や dup は浅い(shallow)コピーであることに注意してください。後述......obj.frozen?) #=> true
p(obj.respond_to?(:fuga)) #=> true
obj_c = obj.clone
p(obj.equal?(obj_c)) #=> false
p(obj == obj_c) #=> true
p(obj_c.tainted?) #=> true
p(obj_c.frozen?) #=> true
p(obj_c.respond_to?(:fuga)) #=> true
obj_d = obj.dup
p(ob......#=> true
p(obj_d.tainted?) #=> true
p(obj_d.frozen?) #=> false
p(obj_d.respond_to?(:fuga)) #=> false
//}
@see Object#initialize_copy
=== 深いコピーと浅いコピー
clone や dup はオブジェクト自身を複製するだけで、オブジェクトの指し
てい......obj.frozen?) #=> true
p(obj.respond_to?(:fuga)) #=> true
obj_c = obj.clone
p(obj.equal?(obj_c)) #=> false
p(obj == obj_c) #=> true
p(obj_c.tainted?) #=> false
p(obj_c.frozen?) #=> true
p(obj_c.respond_to?(:fuga)) #=> true
obj_d = obj.dup
p(o......#=> true
p(obj_d.tainted?) #=> false
p(obj_d.frozen?) #=> false
p(obj_d.respond_to?(:fuga)) #=> false
//}
@see Object#initialize_copy
=== 深いコピーと浅いコピー
clone や dup はオブジェクト自身を複製するだけで、オブジェクトの指し
てい......製を作成して返します。
dup はオブジェクトの内容をコピーし、
clone はそれに加えて freeze, 特異メソッドなどの情報も含めた完全な複製を作成します。
clone や dup は浅い(shallow)コピーであることに注意してください。後述......#=> true
p(obj.frozen?) #=> true
p(obj.respond_to?(:fuga)) #=> true
obj_c = obj.clone
p(obj.equal?(obj_c)) #=> false
p(obj == obj_c) #=> true
p(obj_c.frozen?) #=> true
p(obj_c.respond_to?(:fuga)) #=> true
obj_d = obj.dup
p(obj.equal?(obj_d))......#=> false
p(obj == obj_d) #=> true
p(obj_d.frozen?) #=> false
p(obj_d.respond_to?(:fuga)) #=> false
//}
@see Object#initialize_copy
=== 深いコピーと浅いコピー
clone や dup はオブジェクト自身を複製するだけで、オブジェクトの指し
てい... -
Object
# must _ be _ within _ epsilon(actual , epsilon = 0 . 001) -> true (27200.0) -
自身と実際の値の相対誤差が許容範囲内である場合、検査にパスしたことになります。
...実際の値の相対誤差が許容範囲内である場合、検査にパスしたことになります。
@param actual 実際の値を指定します。
@param epsilon 許容する相対誤差を指定します。
@raise MiniTest::Assertion 検査に失敗した場合に発生します。... -
Object
# singleton _ methods(inherited _ too = true) -> [Symbol] (27136.0) -
そのオブジェクトに対して定義されている特異メソッド名 (public あるいは protected メソッド) の一覧を返します。
...た特異メソッドとは Object#extend によって追加された特異メソッドや、
self がクラスの場合はスーパークラスのクラスメソッド(Classのインスタンスの特異メソッド)などです。
singleton_methods(false) は、Object#methods(false) と同じで......public; def public_self() end
end
# あるオブジェクトの特異メソッドの一覧を得る。
p obj.singleton_methods(false)
p obj.methods(false)
p Foo.singleton_methods(false)
#実行結果
[:protected_self, :public_self]
[:protected_self, :public_self]
[:protected_class_foo, :pub......のクラスメソッドも含まれるよう true を指定したが、
# Object のクラスメソッドは一覧から排除している。
p obj.singleton_methods(true)
p Foo.singleton_methods(true) - Object.singleton_methods(true)
#実行結果
[:protected_self, :public_self, :protected_bar,... -
Object
# singleton _ class -> Class (27118.0) -
レシーバの特異クラスを返します。 まだ特異クラスがなければ、新しく作成します。
...します。
@raise TypeError レシーバが Integer、Float、Symbol の場合に発生します。
//emlist[][ruby]{
Object.new.singleton_class #=> #<Class:#<Object:0xb7ce1e24>>
String.singleton_class #=> #<Class:String>
nil.singleton_class #=> NilClass
//}
@see Object#class... -
Object
# respond _ to _ missing?(symbol , include _ private) -> bool (27112.0) -
自身が symbol で表されるメソッドに対し BasicObject#method_missing で反応するつもりならば真を返します。
...れるメソッドに対し
BasicObject#method_missing で反応するつもりならば真を返します。
Object#respond_to? はメソッドが定義されていない場合、
デフォルトでこのメソッドを呼びだし問合せます。
BasicObject#method_missing を override した......end
end
def respond_to_missing?(sym, include_private)
(sym =~ /^to_*/) ? true : super
end
end
s = Sample.new
s.to_sample("sample args1", "sample args2")
s.respond_to?(:to_sample) # => true
s.respond_to?(:sample) # => false
//}
@see Object#respond_to?, BasicObject#method_missing... -
Object
# singleton _ method(name) -> Method (27112.0) -
オブジェクトの特異メソッド name をオブジェクト化した Method オブ ジェクトを返します。
...o.new(99)
def k.hi
"Hi, @iv = #{@iv}"
end
m = k.singleton_method(:hi) # => #<Method: #<Demo:0xf8b0c3c4 @iv=99>.hi>
m.call #=> "Hi, @iv = 99"
m = k.singleton_method(:hello) # => NameError
//}
@see Module#instance_method, Method, BasicObject#__send__, Object#send, Kernel.#eval, Object#method... -
Object
# respond _ to?(name , include _ all = false) -> bool (27106.0) -
オブジェクトがメソッド name を持つとき真を返します。
...れたメソッドで NotImplementedError が発生する場合は true を返します。
メソッドが定義されていない場合は、Object#respond_to_missing? を呼
び出してその結果を返します。
@param name Symbol または文字列で指定するメソッド名です。
@......ass F
def hello
"Bonjour"
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
modu......espond_to?(:template_method) # => true
# NotImplementedError が発生しているが、Rubyによる実装部のため true を返す
puts NotImplTemplateMethod.new.respond_to?(:template_method) # => true
# GNU/Linux で実行。C言語による実装部のため false を返す
puts File.respond_t... -
Object
# define _ singleton _ method(symbol) { . . . } -> Symbol (27100.0) -
self に特異メソッド name を定義します。
...t[][ruby]{
class A
class << self
def class_name
to_s
end
end
end
A.define_singleton_method(:who_am_i) do
"I am: #{class_name}"
end
A.who_am_i # ==> "I am: A"
guy = "Bob"
guy.define_singleton_method(:hello) { "#{self}: Hello there!" }
guy.hello #=> "Bob: Hello there!"
//}... -
Object
# define _ singleton _ method(symbol , method) -> Symbol (27100.0) -
self に特異メソッド name を定義します。
...t[][ruby]{
class A
class << self
def class_name
to_s
end
end
end
A.define_singleton_method(:who_am_i) do
"I am: #{class_name}"
end
A.who_am_i # ==> "I am: A"
guy = "Bob"
guy.define_singleton_method(:hello) { "#{self}: Hello there!" }
guy.hello #=> "Bob: Hello there!"
//}...