2225件ヒット
[201-300件を表示]
(0.179秒)
別のキーワード
ライブラリ
- ビルトイン (1625)
- csv (75)
- delegate (12)
- digest (12)
- erb (12)
- fiber (8)
- gdbm (24)
-
irb
/ cmd / chws (24) -
irb
/ cmd / pushws (36) -
irb
/ cmd / subirb (48) -
irb
/ extend-command (12) - json (48)
-
json
/ add / exception (12) -
minitest
/ spec (1) -
net
/ http (12) -
net
/ pop (36) - optparse (12)
- pp (24)
- prime (12)
- pstore (36)
- rake (36)
-
rdoc
/ code _ object (12) - set (18)
-
shell
/ filter (6) - thread (12)
- win32ole (36)
- zlib (24)
クラス
- Array (113)
- BasicObject (144)
- Binding (36)
- CSV (36)
-
CSV
:: FieldInfo (36) -
CSV
:: Row (3) - Class (12)
- Data (3)
- ERB (12)
- Enumerator (72)
-
Enumerator
:: Yielder (24) - Exception (12)
- Fiber (42)
- FrozenError (6)
- GDBM (24)
-
IRB
:: ExtendCommand :: ChangeWorkspace (12) -
IRB
:: ExtendCommand :: CurrentWorkingWorkspace (12) -
IRB
:: ExtendCommand :: Foreground (12) -
IRB
:: ExtendCommand :: IrbCommand (12) -
IRB
:: ExtendCommand :: Jobs (12) -
IRB
:: ExtendCommand :: Kill (12) -
IRB
:: ExtendCommand :: PopWorkspace (12) -
IRB
:: ExtendCommand :: PushWorkspace (12) -
IRB
:: ExtendCommand :: Workspaces (12) -
JSON
:: Parser (24) -
JSON
:: State (12) - KeyError (16)
- LocalJumpError (24)
- Method (56)
- Module (180)
- Mutex (2)
- NameError (10)
-
Net
:: HTTPGenericRequest (12) -
Net
:: POPMail (36) - NoMethodError (12)
- Object (481)
- OptionParser (12)
- PStore (36)
- Prime (12)
-
RDoc
:: CodeObject (12) -
Rake
:: TaskArguments (12) - Random (36)
- Range (91)
- Regexp (12)
- Set (24)
-
Shell
:: Filter (6) - StopIteration (12)
- String (13)
- Thread (12)
-
Thread
:: Mutex (10) -
Thread
:: Queue (36) -
Thread
:: SizedQueue (36) - TracePoint (43)
- UnboundMethod (12)
- UncaughtThrowError (22)
-
WIN32OLE
_ EVENT (12) -
WIN32OLE
_ PARAM (12) -
WIN32OLE
_ VARIABLE (12) -
Zlib
:: Deflate (12) -
Zlib
:: GzipWriter (12)
モジュール
- Comparable (12)
- Enumerable (84)
-
IRB
:: ExtendCommandBundle (12) -
JSON
:: Generator :: GeneratorMethods :: Object (12) - Kernel (24)
-
Rake
:: Cloneable (24)
キーワード
- ! (12)
- != (12)
- << (12)
- == (12)
- === (39)
- DelegateClass (12)
- Digest (12)
- [] (48)
-
_ _ send _ _ (24) -
_ dump (12) - all (12)
- allocate (12)
- append (8)
-
append
_ as _ bytes (1) - args (12)
- at (12)
- begin (12)
- bind (12)
-
body
_ stream (12) - call (24)
-
check
_ circular? (12) - clamp (12)
-
class
_ eval (24) -
class
_ exec (12) -
class
_ variable _ get (12) -
class
_ variable _ set (12) - clone (24)
-
const
_ get (12) -
const
_ set (12) - convert (36)
- cover? (12)
- deconstruct (6)
-
def
_ class (12) - default (12)
-
define
_ singleton _ method (24) - delete (36)
- deq (24)
- disable (12)
- display (12)
- divide (24)
- dup (24)
- each (36)
-
each
_ entry (12) - enable (12)
-
enum
_ for (24) - eval (12)
- execute (108)
-
exit
_ value (12) - extend (12)
-
extend
_ object (12) - extended (12)
- feed (12)
- fetch (48)
- first (24)
- flush (12)
- handler= (12)
- header (12)
- index (12)
- initialize (12)
-
initialize
_ copy (12) - inspect (12)
-
instance
_ eval (24) -
instance
_ exec (12) -
instance
_ of? (12) -
instance
_ variable _ defined? (12) -
instance
_ variable _ get (12) -
irb
_ exit (12) -
is
_ a? (12) - key (8)
-
kind
_ of? (12) - last (24)
- line (12)
-
local
_ variable _ get (12) -
local
_ variable _ set (12) - mail (12)
-
marshal
_ dump (12) - match (12)
- max (24)
-
max
_ by (12) -
method
_ missing (12) - methods (12)
- min (24)
-
module
_ eval (24) -
module
_ exec (12) -
must
_ send (1) - next (12)
- pack (21)
- parameters (7)
- params (12)
- parse (12)
- pop (36)
- prepend (8)
-
pretty
_ print (12) -
pretty
_ print _ cycle (12) -
public
_ send (24) - push (8)
- raise (18)
- rand (36)
- reason (12)
- receiver (36)
- reject (12)
-
remove
_ class _ variable (12) -
remove
_ const (12) -
remove
_ instance _ variable (12) -
respond
_ to? (12) -
respond
_ to _ missing? (12) - result (12)
- resume (12)
-
return
_ value (12) - send (24)
- shift (24)
-
singleton
_ method (12) -
singleton
_ method _ added (12) -
singleton
_ method _ removed (12) -
singleton
_ method _ undefined (12) -
singleton
_ methods (12) -
sort
_ by (12) - source (12)
-
start
_ doc (12) - synchronize (12)
- tag (11)
-
to
_ ary (12) -
to
_ enum (24) -
to
_ hash (12) -
to
_ int (12) -
to
_ json (24) -
to
_ proc (12) -
to
_ regexp (12) -
to
_ s (12) -
to
_ str (12) - transaction (12)
- transfer (12)
- unpack (12)
- unshift (8)
- value (23)
-
with
_ object (24) - yield (12)
- | (6)
検索結果
先頭5件
-
IRB
:: ExtendCommand :: Jobs # execute -> IRB :: JobManager (6101.0) -
サブ irb のリストを返します。
サブ irb のリストを返します。 -
BasicObject
# instance _ eval {|obj| . . . } -> object (3137.0) -
オブジェクトのコンテキストで文字列 expr またはオブジェクト自身をブロックパラメータとするブロックを 評価してその結果を返します。
...照してください。
BasicObject を継承して作ったクラス内で instance_eval する場合はトップレベルの定数や Kernel モジュールに定義されているメソッドは見えません。
これは、トップレベルの定数が Object 以下に作成されるため......示などを差し替えることができます。
//emlist[例][ruby]{
class Foo
def initialize data
@key = data
end
private
def do_fuga
p 'secret'
end
end
some = Foo.new 'XXX'
some.instance_eval{p @key} #=> "XXX"
some.instance_eval{do_fuga } #=> "secret" # private メソッド......imeError)
//}
//emlist[例][ruby]{
class Bar < BasicObject
def call1
instance_eval("::ENV.class")
end
def call2
instance_eval("ENV.class")
end
end
bar = Bar.new
bar.call1 # => Object
bar.call2 # raise NameError
//}
@see Module#module_eval, Kernel.#eval, BasicObject#instance_exec... -
BasicObject
# instance _ eval(expr , filename = "(eval)" , lineno = 1) -> object (3137.0) -
オブジェクトのコンテキストで文字列 expr またはオブジェクト自身をブロックパラメータとするブロックを 評価してその結果を返します。
...照してください。
BasicObject を継承して作ったクラス内で instance_eval する場合はトップレベルの定数や Kernel モジュールに定義されているメソッドは見えません。
これは、トップレベルの定数が Object 以下に作成されるため......示などを差し替えることができます。
//emlist[例][ruby]{
class Foo
def initialize data
@key = data
end
private
def do_fuga
p 'secret'
end
end
some = Foo.new 'XXX'
some.instance_eval{p @key} #=> "XXX"
some.instance_eval{do_fuga } #=> "secret" # private メソッド......imeError)
//}
//emlist[例][ruby]{
class Bar < BasicObject
def call1
instance_eval("::ENV.class")
end
def call2
instance_eval("ENV.class")
end
end
bar = Bar.new
bar.call1 # => Object
bar.call2 # raise NameError
//}
@see Module#module_eval, Kernel.#eval, BasicObject#instance_exec... -
BasicObject
# method _ missing(name , *args) -> object (3131.0) -
呼びだされたメソッドが定義されていなかった時、Rubyインタプリタがこのメソッド を呼び出します。
...def initialize(data)
@data = data
end
def method_missing(name, lang)
if name.to_s =~ /\Afind_(\d+)_in\z/
if @data[lang]
p @data[lang][$1.to_i]
else
raise "#{lang} unknown"
end
else
super
end
end
end
dic = Foo.new({:English => %w(zero o......メソッドを override する場合は対象のメソッド名に対して
Object#respond_to? が真を返すようにしてください。
そのためには、Object#respond_to_missing? も同様に override する必
要があります。
@see Object#respond_to?, Object#respond_to_missing?... -
BasicObject
# singleton _ method _ undefined(name) -> object (3131.0) -
特異メソッドが Module#undef_method または undef により未定義にされた時にインタプリタから呼び出されます。
...efined"
end
end
obj = Foo.new
def obj.foo
end
def obj.bar
end
class << obj
undef_method :foo
end
obj.instance_eval {undef bar}
#=> singleton method "foo" was undefined
# singleton method "bar" was undefined
//}
@see Module#method_undefined,BasicObject#singleton_method_added,BasicObject#sin... -
BasicObject
# singleton _ method _ removed(name) -> object (3125.0) -
特異メソッドが Module#remove_method に より削除された時にインタプリタから呼び出されます。
...method_removed(name)
puts "singleton method \"#{name}\" was removed"
end
end
obj = Foo.new
def obj.foo
end
class << obj
remove_method :foo
end
#=> singleton method "foo" was removed
//}
@see Module#method_removed,BasicObject#singleton_method_added,BasicObject#singleton_method_undefined... -
Object
# initialize(*args , &block) -> object (3125.0) -
ユーザ定義クラスのオブジェクト初期化メソッド。
...mlist[][ruby]{
class Foo
def initialize name
puts "initialize Foo"
@name = name
end
end
class Bar < Foo
def initialize name, pass
puts "initialize Bar"
super name
@pass = pass
end
end
it = Bar.new('myname','0500')
p it
#=> initialize Bar
# initialize Foo
# #<Bar:0x2... -
Object
# initialize _ copy(obj) -> object (3125.0) -
(拡張ライブラリによる) ユーザ定義クラスのオブジェクトコピーの初期化メソッド。
...メソッドは self を obj の内容で置き換えます。ただ
し、self のインスタンス変数や特異メソッドは変化しません。
デフォルトでは、Object#clone の内部で Object#initialize_clone から、
また Object#dup の内部で Object#initialize_dup から呼......Object#initialize_copy は、 freeze チェックおよび型のチェックを行い self
を返すだけのメソッドです。
initialize_copy という名前のメソッドは
自動的に private に設定されます。
@raise TypeError レシーバが freeze されているか、obj の......@see Object#clone,Object#dup
以下に例として、dup や clone がこのメソッドをどのように利用しているかを示します。
obj.dup は、新たに生成したオブジェクトに対して
initialize_copy を呼び
//emlist[][ruby]{
obj2 = obj.class.allocate
obj2.initializ... -
Object
# marshal _ dump -> object (3125.0) -
Marshal.#dump を制御するメソッドです。
...d の引数に利用できます。
//emlist[][ruby]{
class Foo
def initialize(arg)
@foo = arg
end
def marshal_dump
@foo
end
def marshal_load(obj)
p obj
@foo = obj
end
end
foo = Foo.new(['foo', 'bar'])
p foo #=> #<Foo:0xbaf3b0 @foo=["foo", "bar"]>
dm......定義されていてもマーシャルできるようになります
(特異メソッドの情報が自動的に dump されるようになるわけではなく、
marshal_dump/marshal_load によりそれを実現する余地があるということです)。
@see Object#marshal_load, Marshal...