ライブラリ
- ビルトイン (564)
-
cgi
/ core (12) -
cgi
/ html (96) -
irb
/ cmd / help (12) -
irb
/ input-method (36) - json (144)
-
minitest
/ unit (1) -
net
/ http (12) - rake (12)
- win32ole (108)
クラス
- CGI (12)
- Exception (12)
-
IRB
:: ExtendCommand :: Help (12) -
IRB
:: InputMethod (12) -
IRB
:: ReadlineInputMethod (24) -
JSON
:: State (12) - Method (24)
-
MiniTest
:: Unit (1) - Module (336)
- NameError (12)
- Object (60)
- Proc (12)
-
RubyVM
:: InstructionSequence (48) - UnboundMethod (72)
-
WIN32OLE
_ METHOD (60) -
WIN32OLE
_ PARAM (48)
モジュール
-
CGI
:: HtmlExtension (96) -
JSON
:: Generator :: GeneratorMethods :: Array (12) -
JSON
:: Generator :: GeneratorMethods :: FalseClass (12) -
JSON
:: Generator :: GeneratorMethods :: Float (12) -
JSON
:: Generator :: GeneratorMethods :: Hash (12) -
JSON
:: Generator :: GeneratorMethods :: Integer (12) -
JSON
:: Generator :: GeneratorMethods :: NilClass (12) -
JSON
:: Generator :: GeneratorMethods :: Object (12) -
JSON
:: Generator :: GeneratorMethods :: String (36) -
JSON
:: Generator :: GeneratorMethods :: TrueClass (12) -
Net
:: HTTPHeader (12)
キーワード
- == (12)
-
absolute
_ path (12) -
alias
_ method (12) - arity (12)
- backtrace (12)
-
base
_ label (12) - clone (12)
-
define
_ method (24) -
define
_ singleton _ method (24) - eql? (12)
-
event
_ interface (12) - execute (12)
-
file
_ name (12) - form (48)
- generate (12)
- gets (12)
- header (12)
- helpstring (12)
- inspect (6)
-
instance
_ method (12) - label (12)
- line (12)
-
method
_ defined? (12) -
module
_ function (24) -
multipart
_ form (48) - name (36)
-
ole
_ type (12) -
ole
_ type _ detail (12) - path (12)
- private (48)
-
private
_ class _ method (24) -
private
_ method _ defined? (12) - protected (36)
-
protected
_ method _ defined? (12) - public (36)
-
public
_ class _ method (24) -
public
_ instance _ method (12) -
public
_ method (12) -
public
_ method _ defined? (12) - puke (1)
-
rake
_ extension (12) -
remove
_ method (12) -
return
_ type _ detail (12) -
singleton
_ method (12) -
source
_ location (36) -
to
_ json (108) -
to
_ json _ raw (12) -
to
_ json _ raw _ object (12) -
to
_ s (42) -
undef
_ method (12)
検索結果
先頭5件
-
Net
:: HTTPHeader # method -> String (21209.0) -
リクエストの HTTP メソッドを文字列で返します。
...リクエストの HTTP メソッドを文字列で返します。
//emlist[例][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri)
req.method # => "GET"
//}... -
Object
# method(name) -> Method (18355.0) -
オブジェクトのメソッド name をオブジェクト化した Method オブジェクトを返します。
...name をオブジェクト化した
Method オブジェクトを返します。
@param name メソッド名をSymbol またはStringで指定します。
@raise NameError 定義されていないメソッド名を引数として与えると発生します。
//emlist[][ruby]{
me = -365.method(:ab......s)
p me #=> #<Method: Integer#abs>
p me.call #=> 365
//}
@see Module#instance_method, Method, BasicObject#__send__, Object#send, Kernel.#eval, Object#singleton_method... -
JSON
:: Generator :: GeneratorMethods :: String # to _ json _ raw -> String (15224.0) -
自身に対して JSON::Generator::GeneratorMethods::String#to_json_raw_object を呼び出して JSON::Generator::GeneratorMethods::Hash#to_json した結果を返します。
...自身に対して JSON::Generator::GeneratorMethods::String#to_json_raw_object を呼び出して JSON::Generator::GeneratorMethods::Hash#to_json した結果を返します。
@see JSON::Generator::GeneratorMethods::String#to_json_raw_object, JSON::Generator::GeneratorMethods::Hash#to_json... -
Method
# source _ location -> [String , Integer] | nil (15220.0) -
ソースコードのファイル名と行番号を配列で返します。
...@see Proc#source_location
//emlist[例][ruby]{
# ------- /tmp/foo.rb ---------
class Foo
def foo; end
end
# ----- end of /tmp/foo.rb ----
require '/tmp/foo'
m = Foo.new.method(:foo) # => #<Method: Foo#foo>
m.source_location # => ["/tmp/foo.rb", 2]
method(:puts).source_location # => nil
//}... -
JSON
:: Generator :: GeneratorMethods :: String # to _ json _ raw _ object -> Hash (15107.0) -
生の文字列を格納したハッシュを生成します。
...する場合に使用してください。
require 'json'
"にほんご".encode("euc-jp").to_json_raw_object
# => {"json_class"=>"String", "raw"=>[164, 203, 164, 219, 164, 243, 164, 180]}
"にほんご".encode("euc-jp").to_json # source sequence is illegal/malformed (JSON::GeneratorError)... -
Module
# instance _ method(name) -> UnboundMethod (12374.0) -
self のインスタンスメソッド name をオブジェクト化した UnboundMethod を返します。
...name をオブジェクト化した UnboundMethod を返します。
@param name メソッド名を Symbol または String で指定します。
@raise NameError self に存在しないメソッドを指定した場合に発生します。
@see Module#public_instance_method, Object#method
//em......ass Interpreter
def do_a() print "there, "; end
def do_d() print "Hello "; end
def do_e() print "!\n"; end
def do_v() print "Dave"; end
Dispatcher = {
"a" => instance_method(:do_a),
"d" => instance_method(:do_d),
"e" => instance_method(:do_e),
"v" => instance_method......(:do_v)
}
def interpret(string)
string.each_char {|b| Dispatcher[b].bind(self).call }
end
end
interpreter = Interpreter.new
interpreter.interpret('dave')
# => Hello there, Dave!
//}... -
Module
# alias _ method(new , original) -> Symbol (12338.0) -
メソッドの別名を定義します。
...ドの別名を定義します。
//emlist[例][ruby]{
module Kernel
alias_method :hoge, :puts # => :hoge
alias_method "foo", :puts # => :foo
end
//}
alias との違いは以下の通りです。
* メソッド名は String または Symbol で指定します
* グローバル変数の別......ん。
@param new 新しいメソッド名。String または Symbol で指定します。
@param original 元のメソッド名。String または Symbol で指定します。
@return 作成したエイリアスのメソッド名を表す Symbol を返します。
@see d:spec/def#alias
//emlis......t[例][ruby]{
module Kernel
alias_method :foo, :puts
end
foo "bar" # bar
//}... -
Module
# public _ instance _ method(name) -> UnboundMethod (12338.0) -
self の public インスタンスメソッド name をオブジェクト化した UnboundMethod を返します。
...タンスメソッド name をオブジェクト化した UnboundMethod を返します。
@param name メソッド名を Symbol または String で指定します。
@raise NameError 定義されていないメソッド名や、
protected メソッド名、 private メソッド名を引......として与えると発生します。
//emlist[例][ruby]{
Kernel.public_instance_method(:object_id) #=> #<UnboundMethod: Kernel#object_id>
Kernel.public_instance_method(:p) # method `p' for module `Kernel' is private (NameError)
//}
@see Module#instance_method,Object#public_method... -
Module
# private _ method _ defined?(name , inherit=true) -> bool (12334.0) -
インスタンスメソッド name がモジュールに定義されており、 しかもその可視性が private であるときに true を返します。 そうでなければ false を返します。
...インスタンスメソッド name がモジュールに定義されており、
しかもその可視性が private であるときに true を返します。
そうでなければ false を返します。
@param name Symbol か String を指定します。
@param inherit 真を指定すると......method_defined?, Module#public_method_defined?, Module#protected_method_defined?
//emlist[例][ruby]{
module A
def method1() end
end
class B
private
def method2() end
end
class C < B
include A
def method3() end
end
A.method_defined? :method1 #=> true
C.private_method......_defined? "method1" #=> false
C.private_method_defined? "method2" #=> true
C.private_method_defined? "method2", true #=> true
C.private_method_defined? "method2", false #=> false
C.method_defined? "method2" #=> false
//}...