2630件ヒット
[1-100件を表示]
(0.113秒)
クラス
-
ARGF
. class (705) - Array (11)
- BasicObject (132)
- Class (22)
- Data (4)
- Dir (66)
-
Enumerator
:: Lazy (11) - Exception (11)
- FalseClass (22)
- File (55)
- IO (55)
- Method (87)
- Module (435)
- NameError (9)
- NilClass (149)
- Object (283)
- Range (11)
- Regexp (11)
-
RubyVM
:: InstructionSequence (11) - Struct (14)
- Thread (22)
-
Thread
:: Backtrace :: Location (44) - TracePoint (44)
- TrueClass (22)
- UnboundMethod (33)
モジュール
- Enumerable (88)
- Kernel (132)
- Marshal (22)
- ObjectSpace (55)
キーワード
- ! (11)
- != (11)
-
$ FILENAME (11) - & (11)
- < (11)
- <=> (11)
- == (22)
- === (11)
- =~ (6)
- ARGF (11)
- BasicObject (11)
- ConditionVariable (9)
- Location (11)
- NIL (8)
- NilClass (11)
- Numeric (11)
- String (11)
- [] (11)
- ^ (11)
-
_ _ send _ _ (22) -
_ dump (11) -
absolute
_ path (11) - arity (22)
-
attr
_ writer (3) - autoload (22)
- autoload? (11)
- backtrace (11)
-
base
_ label (11) - bind (11)
- binmode (11)
- binmode? (11)
-
callee
_ id (11) -
class
_ eval (11) -
class
_ variable _ defined? (11) -
class
_ variable _ get (11) -
class
_ variable _ set (11) -
class
_ variables (11) - codepoints (14)
-
const
_ defined? (11) -
const
_ get (11) -
const
_ missing (11) -
const
_ source _ location (5) - constants (11)
- define (4)
-
define
_ finalizer (22) -
define
_ method (22) -
define
_ singleton _ method (22) -
defined
_ class (11) - display (11)
- dump (22)
- each (33)
-
each
_ char (22) -
each
_ codepoint (22) -
each
_ line (44) -
each
_ object (22) -
external
_ encoding (11) - fail (33)
- file (11)
- filename (11)
- fileno (11)
-
fixed
_ encoding? (11) -
for
_ fd (11) - getbyte (11)
- getc (11)
- gets (33)
-
global
_ variables (11) - include (11)
- include? (11)
- included (11)
- inherited (11)
- initialize (11)
-
initialize
_ copy (11) -
inplace
_ mode (11) -
inplace
_ mode= (11) - inspect (77)
-
instance
_ eval (22) -
instance
_ exec (11) -
instance
_ method (11) -
instance
_ methods (11) -
instance
_ of? (11) -
instance
_ variable _ defined? (11) -
instance
_ variable _ get (11) -
instance
_ variables (11) -
internal
_ encoding (11) -
is
_ a? (11) -
kind
_ of? (11) - lineno (11)
- lineno= (11)
- lines (42)
-
local
_ variables (11) - max (22)
-
method
_ defined? (11) -
method
_ id (11) -
method
_ missing (11) -
method
_ undefined (11) - methods (11)
- min (44)
-
module
_ eval (11) - name (11)
- nesting (11)
- new (91)
- nil? (11)
- open (88)
-
original
_ name (22) - path (22)
- pos (11)
- print (11)
- printf (11)
- private (23)
-
private
_ class _ method (15) -
private
_ constant (11) -
private
_ method _ defined? (11) -
protected
_ method _ defined? (11) -
public
_ class _ method (15) -
public
_ constant (11) -
public
_ method (11) -
public
_ method _ defined? (11) - puts (11)
- raise (33)
- rationalize (22)
- read (11)
-
read
_ nonblock (11) - readbyte (22)
- readchar (11)
- readline (33)
- readlines (33)
- readpartial (11)
- receiver (20)
- refine (11)
-
remove
_ class _ variable (11) -
remove
_ instance _ variable (11) -
respond
_ to? (11) -
respond
_ to _ missing? (11) - rewind (11)
- seek (11)
-
set
_ encoding (33) -
set
_ trace _ func (11) -
singleton
_ class (11) -
singleton
_ class? (11) -
singleton
_ method (11) -
singleton
_ method _ added (11) -
singleton
_ method _ removed (11) -
singleton
_ method _ undefined (11) -
singleton
_ methods (11) - skip (11)
-
sort
_ by (22) -
source
_ location (11) - stat (11)
-
super
_ method (10) - superclass (11)
- tell (11)
-
to
_ a (55) -
to
_ c (11) -
to
_ f (11) -
to
_ h (11) -
to
_ i (22) -
to
_ int (11) -
to
_ io (11) -
to
_ r (11) -
to
_ s (88) -
to
_ str (11) -
to
_ write _ io (11) - unbind (11)
-
undefine
_ finalizer (11) - write (11)
- | (11)
検索結果
先頭5件
-
TracePoint
# defined _ class -> Class | module (15352.0) -
メソッドを定義したクラスかモジュールを返します。
...す。
//emlist[例][ruby]{
class C; def foo; end; end
trace = TracePoint.new(:call) do |tp|
p tp.defined_class # => C
end.enable do
C.new.foo
end
//}
メソッドがモジュールで定義されていた場合も(include に関係なく)モジュー
ルを返します。
//emlist[例][ruby]......{
module M; def foo; end; end
class C; include M; end;
trace = TracePoint.new(:call) do |tp|
p tp.defined_class # => M
end.enable do
C.new.foo
end
//}
[注意] 特異メソッドを実行した場合は TracePoint#defined_class は特異クラ
スを返します。また、Kernel.#set_trace_fun......スではなく元のクラスを返します。
//emlist[例][ruby]{
class C; def self.foo; end; end
trace = TracePoint.new(:call) do |tp|
p tp.defined_class # => #<Class:C>
end.enable do
C.foo
end
//}
Kernel.#set_trace_func と TracePoint の上記の差分に注意して
ください。
@s... -
Class
# superclass -> Class | nil (15321.0) -
自身のスーパークラスを返します。
...//emlist[例][ruby]{
File.superclass #=> IO
IO.superclass #=> Object
class Foo; end
class Bar < Foo; end
Bar.superclass #=> Foo
Object.superclass #=> BasicObject
//}
ただし BasicObject.superclass は nil を返します。
//emlist[例][ruby]{
BasicObject.......superclass #=> nil
//}......superclass #=> nil
//}
@see Class#subclasses... -
ARGF
. class # internal _ encoding -> Encoding | nil (15314.0) -
ARGF から読み込んだ文字列の内部エンコーディングを返します。 内部エンコーディングが指定されていない場合は nil を返します。
...nil を返します。
まだ読み込み処理を始めていない場合は Encoding.default_external を返します。
ARGF.class#set_encoding で設定します。
例:
# $ ruby -Eutf-8 test.rb
# test.rb
ARGF.internal_encoding # => #<Encoding:UTF-8>
ARGF.set_encoding('u......tf-8','ascii')
ARGF.internal_encoding # => #<Encoding:US-ASCII>
例:
ARGF.binmode
ARGF.internal_encoding # => nil
@see IO, ARGF.class#external_encoding... -
Class
# inherited(subclass) -> () (15238.0) -
クラスのサブクラスが定義された時、新しく生成されたサブクラスを引数 にインタプリタから呼び出されます。このメソッドが呼ばれるタイミングは クラス定義文の実行直前です。
...ubclass プログラム内で新たに定義された自身のサブクラスです。
//emlist[例][ruby]{
class Foo
def Foo.inherited(subclass)
puts "class \"#{self}\" was inherited by \"#{subclass}\""
end
end
class Bar < Foo
puts "executing class body"
end
# => class "Foo" was inherit......ed by "Bar"
# executing class body
//}... -
Object
# singleton _ class -> Class (12340.0) -
レシーバの特異クラスを返します。 まだ特異クラスがなければ、新しく作成します。
...が nil か true か false なら、それぞれ NilClass, TrueClass,
FalseClass を返します。
@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
# define _ singleton _ method(symbol) { . . . } -> Symbol (12250.0) -
self に特異メソッド name を定義します。
...String または Symbol で指定します。
@param method Proc、Method あるいは UnboundMethod の
いずれかのインスタンスを指定します。
@return メソッド名を表す Symbol を返します。
//emlist[][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 (12250.0) -
self に特異メソッド name を定義します。
...String または Symbol で指定します。
@param method Proc、Method あるいは UnboundMethod の
いずれかのインスタンスを指定します。
@return メソッド名を表す Symbol を返します。
//emlist[][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!"
//}... -
Module
# class _ variable _ defined?(name) -> bool (12233.0) -
name で与えられた名前のクラス変数がモジュールに存在する場合 true を 返します。
...@param name Symbol か String を指定します。
//emlist[例][ruby]{
class Fred
@@foo = 99
end
Fred.class_variable_defined?(:@@foo) #=> true
Fred.class_variable_defined?(:@@bar) #=> false
Fred.class_variable_defined?('@@foo') #=> true
Fred.class_variable_defined?('@@bar') #=> fals... -
Module
# class _ variables(inherit = true) -> [Symbol] (12233.0) -
クラス/モジュールに定義されているクラス変数の名前の配列を返します。
...am inherit false を指定しない場合はスーパークラスやインクルードして
いるモジュールのクラス変数を含みます。
//emlist[例][ruby]{
class One
@@var1 = 1
end
class Two < One
@@var2 = 2
end
One.class_variables # => [:@@var1]
Two.class_variab......les # => [:@@var2, :@@var1]
Two.class_variables(false) # => [:@@var2]
//}
@see Module.constants, Kernel.#local_variables, Kernel.#global_variables, Object#instance_variables, Module#constants... -
Module
# public _ class _ method(*name) -> self (12228.0) -
name で指定したクラスメソッド (クラスの特異メソッド) の 可視性を public に変更します。
...可視性を public に変更します。
@param name 0 個以上の String または Symbol を指定します。
@param names 0 個以上の String または Symbol を Array で指定します。
//emlist[例][ruby]{
class Foo
def self.foo
"foo"
end
private_class_method :foo
end
F......oo.foo # NoMethodError: private method `foo' called for Foo:Class
Foo.public_class_method(:foo) # => Foo
Foo.foo # => "foo"
//}...