るりまサーチ

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

別のキーワード

  1. _builtin end
  2. ripper end_seen?
  3. _builtin exclude_end?
  4. _builtin end_with?
  5. rexml end_element

ライブラリ

クラス

キーワード

検索結果

<< 1 2 > >>

Method#inspect -> String (18198.0)

self を読みやすい文字列として返します。

...式の文字列を返します。

#<Method: klass1(klass2)#method> (形式1)

klass1 は、Method#inspect では、レシーバのクラス名、
UnboundMethod#inspect では、UnboundMethod オブジェクトの生成
元となったクラス/モジュール名です。

klass2...
...モジュール名、
method は、メソッド名を表します。

//emlist[例][ruby]{
module Foo
def foo
"foo"
end

end

class Bar
include Foo
def bar
end

end


p Bar.new.method(:foo) # => #<Method: Bar(Foo)#foo>
p Bar.new.method(:bar) # => #<Method: Bar#bar>
//}

klass...
...ss <<obj
def foo
end

end

p obj.method(:foo) # => #<Method: "".foo>

# クラスメソッド(クラスの特異メソッド)
class Foo
def Foo.foo
end

end

p Foo.method(:foo) # => #<Method: Foo.foo>

# スーパークラスのクラスメソッド
class Bar < Foo
end

p Bar.method(:fo...
...の文字列を返します。

#<Method: klass1(klass2)#method(arg) foo.rb:2> (形式1)

klass1 は、Method#inspect では、レシーバのクラス名、
UnboundMethod#inspect では、UnboundMethod オブジェクトの生成
元となったクラス/モジュール名です。

klass2...
...ます。
source_location が nil の場合には付きません。

//emlist[例][ruby]{
module Foo
def foo
"foo"
end

end

class Bar
include Foo
def bar(a, b)
end

end


p Bar.new.method(:foo) # => #<Method: Bar(Foo)#foo() test.rb:2>
p Bar.new.method(:bar) # => #<Method: Ba...
...ef foo
end

end

p obj.method(:foo) # => #<Method: "".foo() foo.rb:4>

# クラスメソッド(クラスの特異メソッド)
class Foo
def Foo.foo
end

end

p Foo.method(:foo) # => #<Method: Foo.foo() foo.rb:11>

# スーパークラスのクラスメソッド
class Bar < Foo
end

p Bar...

Object#inspect -> String (18168.0)

オブジェクトを人間が読める形式に変換した文字列を返します。

...して
オブジェクトを表示します。

//emlist[][ruby]{
[ 1, 2, 3..4, 'five' ].inspect # => "[1, 2, 3..4, \"five\"]"
Time.new.inspect # => "2008-03-08 19:43:39 +0900"
//}

inspect
メソッドをオーバーライドしなかった場合、クラス名とインスタン...
...変数の名前、値の組を元にした文字列を返します。

//emlist[][ruby]{
class Foo
end

Foo.new.inspect # => "#<Foo:0x0300c868>"

class Bar
def initialize
@
bar = 1
end

end

Bar.new.inspect # => "#<Bar:0x0300c868 @bar=1>"
//}

@
see Kernel.#p...

Thread::Backtrace::Location#inspect -> String (18132.0)

Thread::Backtrace::Location#to_s の結果を人間が読みやすいような文 字列に変換したオブジェクトを返します。

...

//emlist[例][ruby]{
# foo.rb
class Foo
attr_accessor :locations
def initialize(skip)
@
locations = caller_locations(skip)
end

end


Foo.new(0..2).locations.map do |call|
puts call.inspect
end


# => "path/to/foo.rb:5:in `initialize'"
# "path/to/foo.rb:9:in `new'"
# "path/to/foo.rb:9:i...

Module#inspect -> String (18126.0)

モジュールやクラスの名前を文字列で返します。

...が挙げられます。

@
return 名前のないモジュール / クラスに対しては、name は nil を、それ以外はオブジェクト ID の文字列を返します。

//emlist[例][ruby]{
module A
module B
end


p B.name #=> "A::B"

class C
end

end


p A.name #=> "A"
p A::...

Method#to_s -> String (3098.0)

self を読みやすい文字列として返します。

...式の文字列を返します。

#<Method: klass1(klass2)#method> (形式1)

klass1 は、Method#inspect では、レシーバのクラス名、
UnboundMethod#inspect では、UnboundMethod オブジェクトの生成
元となったクラス/モジュール名です。

klass2...
...モジュール名、
method は、メソッド名を表します。

//emlist[例][ruby]{
module Foo
def foo
"foo"
end

end

class Bar
include Foo
def bar
end

end


p Bar.new.method(:foo) # => #<Method: Bar(Foo)#foo>
p Bar.new.method(:bar) # => #<Method: Bar#bar>
//}

klass...
...ss <<obj
def foo
end

end

p obj.method(:foo) # => #<Method: "".foo>

# クラスメソッド(クラスの特異メソッド)
class Foo
def Foo.foo
end

end

p Foo.method(:foo) # => #<Method: Foo.foo>

# スーパークラスのクラスメソッド
class Bar < Foo
end

p Bar.method(:fo...
...の文字列を返します。

#<Method: klass1(klass2)#method(arg) foo.rb:2> (形式1)

klass1 は、Method#inspect では、レシーバのクラス名、
UnboundMethod#inspect では、UnboundMethod オブジェクトの生成
元となったクラス/モジュール名です。

klass2...
...ます。
source_location が nil の場合には付きません。

//emlist[例][ruby]{
module Foo
def foo
"foo"
end

end

class Bar
include Foo
def bar(a, b)
end

end


p Bar.new.method(:foo) # => #<Method: Bar(Foo)#foo() test.rb:2>
p Bar.new.method(:bar) # => #<Method: Ba...
...ef foo
end

end

p obj.method(:foo) # => #<Method: "".foo() foo.rb:4>

# クラスメソッド(クラスの特異メソッド)
class Foo
def Foo.foo
end

end

p Foo.method(:foo) # => #<Method: Foo.foo() foo.rb:11>

# スーパークラスのクラスメソッド
class Bar < Foo
end

p Bar...

絞り込み条件を変える

Module#name -> String | nil (3026.0)

モジュールやクラスの名前を文字列で返します。

...が挙げられます。

@
return 名前のないモジュール / クラスに対しては、name は nil を、それ以外はオブジェクト ID の文字列を返します。

//emlist[例][ruby]{
module A
module B
end


p B.name #=> "A::B"

class C
end

end


p A.name #=> "A"
p A::...

Module#to_s -> String (3026.0)

モジュールやクラスの名前を文字列で返します。

...が挙げられます。

@
return 名前のないモジュール / クラスに対しては、name は nil を、それ以外はオブジェクト ID の文字列を返します。

//emlist[例][ruby]{
module A
module B
end


p B.name #=> "A::B"

class C
end

end


p A.name #=> "A"
p A::...

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

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

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

@
raise TypeError レシーバが freeze されているか、obj のクラスがレシーバ
のクラスと異なる場合に発生します。
@
see Object#clone,Object#dup

以下に例として、dup や clone がこの...
...cessor :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

end


obj.foo = 1
obj.taint

check Object.new.send(:initialize_copy, obj)...
...ce variables: #<Object:0x4019c9c0 @foo=1>
# tainted?: true
# singleton methods: #<NoMethodError: ...>
check obj.clone
#=> instance variables: #<Object:0x4019c880 @foo=1>
# tainted?: true
# singleton methods: :bar
//}

@
see Object#initialize_clone, Obje...
...class <<obj
attr_accessor :foo
def bar
:bar
end

end


def check(obj)
puts "instance 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 variabl...
....>
check obj.dup
#=> instance variables: #<Object:0x4019c9c0 @foo=1>
# singleton methods: #<NoMethodError: ...>
check obj.clone
#=> instance variables: #<Object:0x4019c880 @foo=1>
# singleton methods: :bar
//}

@
see Object#initialize_clone, Object#initialize_dup...

WIN32OLE_EVENT#handler=(obj) -> () (61.0)

イベント処理を実行するオブジェクトを登録します。

...、正確な記述が必要です。

@
param obj イベントに対応するメソッドを持つオブジェクト。イベント受信を
解除するにはnilを指定します。

class IeHandler
def initialize
@
completed = false
end

attr_reader :completed
def...
...t.getElementsByTagName('a').each do |e|
puts "#{e.innerHTML}=#{e.href}"
end

@
completed = true
end

def method_missing(id, *args)
puts "event=#{id.to_s}, args=#{args.inspect}"
end

end


ie = WIN32OLE.new('InternetExplorer.Application.1')
event = WIN32OLE_EVEN...
...event.handler = IeHandler.new
ie.Navigate2 'http://www.ruby-lang.org/ja/'
loop do
break if event.handler.completed
WIN32OLE_EVENT.message_loop
end

ie.Quit

WIN32OLE_EVENT#on_eventなどの呼び出しでブロックが登録されている場
合、そちらが優先されます。...
<< 1 2 > >>