3647件ヒット
[1-100件を表示]
(0.055秒)
別のキーワード
ライブラリ
- ビルトイン (1772)
-
cgi
/ core (22) -
cgi
/ html (88) - delegate (44)
- drb (11)
- erb (44)
- fileutils (22)
- forwardable (88)
-
irb
/ cmd / help (11) -
irb
/ context (22) -
irb
/ extend-command (11) -
irb
/ input-method (198) -
irb
/ output-method (55) - json (154)
-
minitest
/ spec (1) -
minitest
/ unit (3) -
net
/ http (22) -
net
/ imap (22) - objspace (11)
- openssl (143)
- ostruct (11)
- pp (11)
- profiler (6)
- psych (8)
- rake (33)
- rdoc (11)
-
rdoc
/ code _ object (11) -
rdoc
/ context (66) -
rdoc
/ stats (11) -
rdoc
/ top _ level (11) -
shell
/ command-processor (6) -
webrick
/ cgi (11) -
webrick
/ httprequest (11) -
webrick
/ httpresponse (11) -
webrick
/ httpservlet / abstract (11) - win32ole (484)
クラス
- Array (9)
- BasicObject (66)
- CGI (11)
-
DRb
:: DRbServer (11) - Delegator (44)
- ERB (33)
- Enumerator (58)
-
Enumerator
:: Lazy (44) - Exception (11)
-
IRB
:: Context (22) -
IRB
:: ExtendCommand :: Help (11) -
IRB
:: FileInputMethod (33) -
IRB
:: InputMethod (33) -
IRB
:: OutputMethod (44) -
IRB
:: ReadlineInputMethod (66) -
IRB
:: StdioInputMethod (66) -
IRB
:: StdioOutputMethod (11) -
JSON
:: State (22) - Method (247)
-
MiniTest
:: Unit (1) -
MiniTest
:: Unit :: TestCase (1) - Module (362)
- NameError (22)
-
Net
:: HTTPGenericRequest (11) -
Net
:: IMAP (22) - NoMethodError (36)
- Object (199)
-
OpenSSL
:: Engine (99) -
OpenSSL
:: SSL :: SSLContext (44) - PP (11)
- Proc (50)
-
RDoc
:: CodeObject (11) -
RDoc
:: Context (66) -
RDoc
:: Stats (11) -
RDoc
:: TopLevel (11) -
Rake
:: FileList (22) - Refinement (3)
- Regexp (44)
-
RubyVM
:: InstructionSequence (99) -
Shell
:: CommandProcessor (6) - String (55)
- Thread (11)
- TracePoint (39)
- UnboundMethod (163)
-
WEBrick
:: CGI (11) -
WEBrick
:: HTTPRequest (11) -
WEBrick
:: HTTPResponse (11) -
WEBrick
:: HTTPServlet :: AbstractServlet (11) - WIN32OLE (132)
-
WIN32OLE
_ EVENT (11) -
WIN32OLE
_ METHOD (209) -
WIN32OLE
_ PARAM (110) -
WIN32OLE
_ TYPE (22)
モジュール
-
CGI
:: HtmlExtension (88) -
CGI
:: QueryExtension (11) -
ERB
:: DefMethod (11) - FileUtils (22)
- Forwardable (44)
-
IRB
:: ExtendCommandBundle (11) -
JSON
:: Generator :: GeneratorMethods :: Array (11) -
JSON
:: Generator :: GeneratorMethods :: FalseClass (11) -
JSON
:: Generator :: GeneratorMethods :: Float (11) -
JSON
:: Generator :: GeneratorMethods :: Hash (11) -
JSON
:: Generator :: GeneratorMethods :: Integer (11) -
JSON
:: Generator :: GeneratorMethods :: NilClass (11) -
JSON
:: Generator :: GeneratorMethods :: Object (11) -
JSON
:: Generator :: GeneratorMethods :: String (33) -
JSON
:: Generator :: GeneratorMethods :: String :: Extend (11) -
JSON
:: Generator :: GeneratorMethods :: TrueClass (11) - Kernel (189)
- Marshal (22)
-
MiniTest
:: Assertions (1) -
Net
:: HTTPHeader (11) - ObjectSpace (11)
- RDoc (11)
-
RubyVM
:: AbstractSyntaxTree (8) - SingleForwardable (44)
オブジェクト
- main (22)
キーワード
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (11) - << (12)
- == (22)
- === (7)
- >> (12)
-
ARRAY
_ METHODS (11) -
DELEGATING
_ METHODS (11) -
INSECURE
_ METHOD (11) - METHODS (22)
-
METHOD
_ ALL (11) -
METHOD
_ CIPHERS (11) -
METHOD
_ DH (11) -
METHOD
_ DIGESTS (11) -
METHOD
_ DSA (11) -
METHOD
_ MODIFIERS (11) -
METHOD
_ NONE (11) -
METHOD
_ RAND (11) -
METHOD
_ RSA (11) -
NEWS for Ruby 2
. 5 . 0 (7) -
NEWS for Ruby 3
. 0 . 0 (4) - NoDelegateMethods (6)
- NoMethodError (11)
- Numeric (11)
- OpenStruct (11)
-
Profiler
_ _ (6) - Ruby プログラムの実行 (11)
- Rubyで使われる記号の意味(正規表現の複雑な記号は除く) (11)
- [] (33)
-
_ _ callee _ _ (11) -
_ _ method _ _ (11) -
_ getproperty (11) -
_ invoke (11) -
_ setproperty (11) -
absolute
_ path (11) -
add
_ method (11) -
add
_ response _ handler (22) -
add
_ to (11) -
alias
_ method (11) - args (11)
- arity (22)
-
assert
_ respond _ to (1) - backtrace (11)
-
base
_ label (11) - bind (11)
-
bind
_ call (10) - call (22)
-
callee
_ id (11) - caller (33)
- cgi (11)
-
cgi
/ session (11) -
class
_ exec (11) - clone (22)
-
collect
_ method (11) -
count
_ nodes (11) - curry (20)
- debug (11)
-
def
_ class (11) -
def
_ delegator (22) -
def
_ delegators (22) -
def
_ erb _ method (11) -
def
_ instance _ delegator (11) -
def
_ instance _ delegators (11) -
def
_ method (11) -
def
_ module (11) -
def
_ single _ delegator (11) -
def
_ single _ delegators (11) - default (11)
-
default
_ event _ sources (11) -
define
_ method (44) -
define
_ singleton _ method (22) - dig (9)
- disasm (11)
- disassemble (11)
- dispid (11)
- dump (22)
- each (44)
-
each
_ method (11) - encode (33)
- encoding (33)
-
enum
_ for (44) - eof? (22)
- eql? (22)
- eval (22)
- event? (11)
-
event
_ interface (11) - execute (11)
- fail (33)
-
file
_ name (11) -
find
_ local _ symbol (11) -
first
_ lineno (11) - form (44)
- generate (11)
- gets (33)
- handler= (11)
- hash (22)
- header (11)
- helpcontext (11)
- helpfile (11)
- helpstring (11)
-
import
_ methods (3) -
initialize
_ methods _ etc (11) - input? (11)
- inspect (22)
-
instance
_ eval (22) -
instance
_ method (11) -
instance
_ methods (11) - invkind (11)
-
invoke
_ kind (11) - io (11)
- irb (11)
-
irb
/ completion (11) -
irb
_ original _ method _ name (11) -
json
_ create (11) - label (11)
- lambda (17)
- lambda? (11)
-
last
_ match (22) - line (22)
- match (22)
- method (33)
-
method
_ added (11) -
method
_ defined? (11) -
method
_ id (11) -
method
_ list (11) -
method
_ missing (33) -
method
_ removed (11) -
method
_ undefined (11) - methods (22)
-
module
_ exec (11) -
module
_ function (19) -
multipart
_ form (44) -
must
_ respond _ to (1) - name (55)
- new (141)
-
num
_ methods (11) - of (19)
-
offset
_ vtbl (11) -
ole
_ activex _ initialize (11) -
ole
_ func _ methods (11) -
ole
_ get _ methods (11) -
ole
_ method (11) -
ole
_ method _ help (11) -
ole
_ methods (22) -
ole
_ put _ methods (11) -
ole
_ show _ help (11) -
ole
_ type (11) -
ole
_ type _ detail (11) - optional? (11)
-
original
_ name (22) - output? (11)
- owner (22)
- parameters (39)
- params (11)
- path (11)
- pp (11)
- ppx (11)
- print (11)
- printn (11)
- private (23)
-
private
_ call? (8) -
private
_ class _ method (15) -
private
_ instance _ methods (11) -
private
_ method _ defined? (11) -
private
_ methods (11) - proc (18)
- protected (23)
-
protected
_ instance _ methods (11) -
protected
_ method _ defined? (11) -
protected
_ methods (22) -
psych
_ yaml _ as (4) - public (23)
-
public
_ class _ method (15) -
public
_ instance _ method (11) -
public
_ instance _ methods (11) -
public
_ method (11) -
public
_ method _ defined? (11) -
public
_ methods (22) - puke (1)
- puts (11)
- raise (33)
-
rake
_ extension (11) - rdoc (11)
-
readable
_ atfer _ eof? (33) - receiver (11)
-
remove
_ method (11) -
remove
_ methods _ etc (11) -
renegotiation
_ cb= (11) -
request
_ method (33) -
require
_ relative (11) -
respond
_ to? (11) -
respond
_ to _ missing? (11) -
return
_ type (11) -
return
_ type _ detail (11) -
return
_ vtype (11) - retval? (11)
-
rexml
/ parsers / sax2parser (11) -
rexml
/ parsers / streamparser (11) -
ruby 1
. 6 feature (11) -
ruby 1
. 8 . 3 feature (11) -
ruby 1
. 8 . 4 feature (11) -
ruby2
_ keywords (10) - send (22)
- seplist (11)
- service (22)
-
set
_ default (11) -
set
_ visibility _ for (11) -
singleton
_ method (11) -
singleton
_ method _ added (11) -
singleton
_ method _ removed (11) -
singleton
_ method _ undefined (11) -
singleton
_ methods (11) -
size
_ opt _ params (11) -
size
_ params (11) -
source
_ location (33) -
super
_ method (20) -
test
_ methods (1) -
to
_ a (11) -
to
_ enum (44) -
to
_ json (99) -
to
_ json _ raw (11) -
to
_ json _ raw _ object (11) -
to
_ proc (11) -
to
_ s (66) -
to
_ str (11) - unbind (11)
-
undef
_ method (11) - visible? (11)
- xmlrpc (3)
-
yaml
_ as (4) - クラス/メソッドの定義 (11)
- 制御構造 (11)
検索結果
先頭5件
-
Method (38100.0)
-
Object#method によりオブジェクト化され たメソッドオブジェクトのクラスです。
...ject#method によりオブジェクト化され
たメソッドオブジェクトのクラスです。
メソッドの実体(名前でなく)とレシーバの組を封入します。
Proc オブジェクトと違ってコンテキストを保持しません。
=== Proc との差
Method は......は使い捨てに向き、Method は何度も繰り返し生成する
場合に向くと言えます。また内包するコードの大きさという点では
Proc は小規模、Method は大規模コードに向くと言えます。
既存のメソッドを Method オブジェクト化する......oo.new.method(:foo)
p m # => #<Method: Foo#foo>
p m.call(1) # => "foo called with arg 1"
//}
名前のないメソッド(の代わり)が必要なら Proc を使うと良い。
//emlist[例][ruby]{
pr = Proc.new {|arg|
"proc called with arg #{arg}"
}
p pr # => #<Proc... -
Method
# super _ method -> Method | nil (27390.0) -
self 内で super を実行した際に実行されるメソッドを Method オブジェ クトにして返します。
...ドを Method オブジェ
クトにして返します。
@see UnboundMethod#super_method
//emlist[例][ruby]{
class Super
def foo
"superclass method"
end
end
class Sub < Super
def foo
"subclass method"
end
end
m = Sub.new.method(:foo) # => #<Method: Sub#foo>
m.call # => "subclas......s method"
m.super_method # => #<Method: Super#foo>
m.super_method.call # => "superclass method"
//}... -
Method
# >>(callable) -> Proc (27136.0) -
self と引数を合成した Proc を返します。
...
Method#<< とは呼び出しの順序が逆になります。
@param callable Proc、Method、もしくは任意の call メソッドを持ったオブジェクト。
//emlist[例][ruby]{
def f(x)
x * x
end
def g(x)
x + x
end
# (3 * 3) + (3 * 3)
p (method(:f) >> method(:g)).call(3) # => 18......uby]{
class WordScanner
def self.call(str)
str.scan(/\w+/)
end
end
File.write('testfile', <<~TEXT)
Hello, World!
Hello, Ruby!
TEXT
pipeline = File.method(:read) >> WordScanner >> method(:pp)
pipeline.call('testfile') # => ["Hello", "World", "Hello", "Ruby"]
//}
@see Proc#<<, Proc#>>... -
Method
# inspect -> String (21298.0) -
self を読みやすい文字列として返します。
...します。
以下の形式の文字列を返します。
#<Method: klass1(klass2)#method(arg) foo.rb:2> (形式1)
klass1 は、Method#inspect では、レシーバのクラス名、
UnboundMethod#inspect では、UnboundMethod オブジェクトの生成
元となったクラス/モジ......klass2 は、実際にそのメソッドを定義しているクラス/モジュール名、
method は、メソッド名を表します。
arg は引数を表します。
「foo.rb:2」は Method#source_location を表します。
source_location が nil の場合には付きません。
//em......r(a, b)
end
end
p Bar.new.method(:foo) # => #<Method: Bar(Foo)#foo() test.rb:2>
p Bar.new.method(:bar) # => #<Method: Bar#bar(a, b) test.rb:8>
//}
klass1 と klass2 が同じ場合は以下の形式になります。
#<Method: klass1#method() foo.rb:2> (形式2)
特... -
Method
# to _ s -> String (21298.0) -
self を読みやすい文字列として返します。
...します。
以下の形式の文字列を返します。
#<Method: klass1(klass2)#method(arg) foo.rb:2> (形式1)
klass1 は、Method#inspect では、レシーバのクラス名、
UnboundMethod#inspect では、UnboundMethod オブジェクトの生成
元となったクラス/モジ......klass2 は、実際にそのメソッドを定義しているクラス/モジュール名、
method は、メソッド名を表します。
arg は引数を表します。
「foo.rb:2」は Method#source_location を表します。
source_location が nil の場合には付きません。
//em......r(a, b)
end
end
p Bar.new.method(:foo) # => #<Method: Bar(Foo)#foo() test.rb:2>
p Bar.new.method(:bar) # => #<Method: Bar#bar(a, b) test.rb:8>
//}
klass1 と klass2 が同じ場合は以下の形式になります。
#<Method: klass1#method() foo.rb:2> (形式2)
特... -
Method
# inspect -> String (21292.0) -
self を読みやすい文字列として返します。
...します。
以下の形式の文字列を返します。
#<Method: klass1(klass2)#method> (形式1)
klass1 は、Method#inspect では、レシーバのクラス名、
UnboundMethod#inspect では、UnboundMethod オブジェクトの生成
元となったクラス/モジュ......ュール名、
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>
//}
klass1 と......が同じ場合は以下の形式になります。
#<Method: klass1#method> (形式2)
特異メソッドに対しては、
#<Method: obj.method> (形式3)
#<Method: klass1(klass2).method> (形式4)
という形式の文字列を... -
Method
# to _ s -> String (21292.0) -
self を読みやすい文字列として返します。
...します。
以下の形式の文字列を返します。
#<Method: klass1(klass2)#method> (形式1)
klass1 は、Method#inspect では、レシーバのクラス名、
UnboundMethod#inspect では、UnboundMethod オブジェクトの生成
元となったクラス/モジュ......ュール名、
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>
//}
klass1 と......が同じ場合は以下の形式になります。
#<Method: klass1#method> (形式2)
特異メソッドに対しては、
#<Method: obj.method> (形式3)
#<Method: klass1(klass2).method> (形式4)
という形式の文字列を... -
Method
# unbind -> UnboundMethod (21248.0) -
self のレシーバとの関連を取り除いた UnboundMethod オブ ジェクトを生成して返します。
...いた UnboundMethod オブ
ジェクトを生成して返します。
//emlist[例][ruby]{
class Foo
def foo
"foo"
end
end
m = Foo.new.method(:foo) # => #<Method: Foo#foo>
unbound_method = m.unbind # => #<UnboundMethod: Foo#foo>
unbound_method.bind(Foo.new) # => #<Method: Foo#foo>
//}... -
Method
# clone -> Method (21247.0) -
自身を複製した Method オブジェクトを作成して返します。
...自身を複製した Method オブジェクトを作成して返します。
//emlist[例][ruby]{
class Foo
def foo
"foo"
end
end
m = Foo.new.method(:foo) # => #<Method: Foo#foo>
m.call # => "foo"
m.clone # => #<Method: Foo#foo>
m.clone.call # => "foo"
//}... -
Method
# arity -> Integer (21160.0) -
メソッドが受け付ける引数の数を返します。
...p c.method(:u).arity #=> 0
p c.method(:v).arity #=> 1
p c.method(:w).arity #=> -1
p c.method(:x).arity #=> 2
p c.method(:y).arity #=> -3
p c.method(:z).arity #=> -3
s = "xyz"
s.method(:size).arity #=> 0
s.method(:replace).arity #=> 1
s.method(:squeeze).arity #=> -1......s.method(:count).arity #=> -1
//}... -
Method
# parameters -> [object] (21140.0) -
Method オブジェクトの引数の情報を返します。
...Method オブジェクトの引数の情報を返します。
Method オブジェクトが引数を取らなければ空の配列を返します。引数を取る場合は、配列の配列を返し、
各配列の要素は引数の種類に応じた以下のような Symbol と、仮引数の名......t[例][ruby]{
m = Class.new{define_method(:m){|x, y=42, *other, k_x:, k_y: 42, **k_other, &b|}}.instance_method(:m)
m.parameters #=> x], [:opt, :y], [:rest, :other], [:keyreq, :k_x], [:key, :k_y], [:keyrest, :k_other], [:block, :b
File.method(:symlink).parameters #=> req
//}
@see Proc#parameters......st[例][ruby]{
m = Class.new{define_method(:m){|x, y=42, *other, k_x:, k_y: 42, **k_other, &b|}}.instance_method(:m)
m.parameters #=> x], [:opt, :y], [:rest, :other], [:keyreq, :k_x], [:key, :k_y], [:keyrest, :k_other], [:block, :b
File.method(:symlink).parameters #=> req
//}
@see Proc#parameters... -
Method
# <<(callable) -> Proc (21136.0) -
self と引数を合成した Proc を返します。
...
Method#>> とは呼び出しの順序が逆になります。
@param callable Proc、Method、もしくは任意の call メソッドを持ったオブジェクト。
//emlist[例][ruby]{
def f(x)
x * x
end
def g(x)
x + x
end
# (3 + 3) * (3 + 3)
p (method(:f) << method(:g)).call(3) # => 36......uby]{
class WordScanner
def self.call(str)
str.scan(/\w+/)
end
end
File.write('testfile', <<~TEXT)
Hello, World!
Hello, Ruby!
TEXT
pipeline = method(:pp) << WordScanner << File.method(:read)
pipeline.call('testfile') # => ["Hello", "World", "Hello", "Ruby"]
//}
@see Proc#<<, Proc#>>... -
Method
# owner -> Class | Module (21136.0) -
このメソッドが定義されている class か module を返します。
...定義されている class か module を返します。
//emlist[例][ruby]{
class Foo
def foo(arg)
"foo called with arg #{arg}"
end
end
m = Foo.new.method(:foo) # => #<Method: Foo#foo>
m.owner # => Foo
m = Foo.new.method(:puts) # => #<Method: Foo(Kernel)#puts>
m.owner # => Kernel
//}...