1804件ヒット
[1501-1600件を表示]
(0.060秒)
ライブラリ
- ビルトイン (721)
- delegate (12)
- digest (12)
- e2mmap (6)
-
irb
/ cmd / load (12) -
irb
/ xmp (12) - json (24)
-
minitest
/ unit (1) - mkmf (612)
- open-uri (24)
- openssl (24)
- pathname (12)
- pp (12)
- psych (24)
- rake (36)
-
rubygems
/ custom _ require (12) - scanf (12)
- shell (12)
-
shell
/ command-processor (12) -
shell
/ filter (12) - stringio (72)
- timeout (8)
- un (72)
- zlib (48)
クラス
-
ARGF
. class (75) - Array (48)
- BasicObject (24)
- Binding (12)
- Exception (24)
- IO (84)
-
IRB
:: ExtendCommand :: Load (12) - LoadError (12)
- Module (132)
- Object (144)
-
OpenSSL
:: BN (12) - Shell (12)
-
Shell
:: CommandProcessor (12) -
Shell
:: Filter (12) - String (72)
- StringIO (72)
- SystemExit (12)
- Thread (72)
- TracePoint (12)
- UncaughtThrowError (22)
-
Zlib
:: GzipWriter (48)
モジュール
- Exception2MessageMapper (6)
- Kernel (836)
-
MiniTest
:: Assertions (1) -
OpenSSL
:: Buffering (12) -
OpenURI
:: OpenRead (24)
キーワード
- % (12)
- DelegateClass (12)
- Digest (12)
- JSON (12)
- Pathname (12)
- [] (18)
-
add
_ trace _ func (12) - ancestors (12)
- autoload (12)
-
cc
_ command (12) -
check
_ signedness (24) -
check
_ sizeof (24) - class (12)
-
class
_ eval (24) -
const
_ defined? (12) - constants (12)
-
convertible
_ int (24) - cp (12)
-
create
_ makefile (12) -
create
_ tmpsrc (12) -
defined
_ class (12) -
depend
_ rules (12) - desc (12)
-
egrep
_ cpp (24) - eval (12)
- exception (24)
- execute (12)
- exit (12)
-
find
_ executable (12) -
find
_ header (12) -
find
_ library (24) -
find
_ type (24) - freeze (12)
- gets (27)
-
have
_ header (24) -
have
_ macro (24) -
have
_ struct _ member (24) -
have
_ type (24) - help (12)
- hex (12)
- httpd (12)
- import (12)
- include (12)
- inspect (12)
- install (12)
-
install
_ files (12) -
instance
_ eval (24) -
instance
_ variables (12) - j (12)
- kill (12)
- libpathflag (12)
-
link
_ command (12) - method (12)
- mkdir (12)
-
module
_ eval (24) - namespace (12)
- oct (12)
- open (24)
- path (12)
-
pretty
_ print (24) - print (60)
- printf (60)
-
psych
_ y (12) -
public
_ instance _ method (12) - putc (36)
- puts (48)
- raise (12)
-
remove
_ const (12) - reopen (60)
- require (12)
- rmdir (12)
- sample (48)
- scanf (12)
- send (24)
-
set
_ trace _ func (12) - skip (1)
- status (12)
- tag (11)
- terminate (12)
- test (18)
-
to
_ a (12) -
to
_ ary (12) -
to
_ f (12) -
to
_ i (12) -
to
_ int (12) -
to
_ str (12) -
try
_ compile (24) -
try
_ constant (24) -
try
_ cpp (24) -
try
_ do (24) -
try
_ link (24) -
try
_ run (24) -
try
_ static _ assert (24) -
try
_ type (24) - value (11)
-
with
_ werror (24) - xmp (12)
- xpopen (24)
- xsystem (12)
- y (12)
検索結果
先頭5件
-
Shell
:: Filter # test(command , file1 , file2 = nil) -> bool | Time | Integer | nil (59.0) -
Kernel.#test や FileTest のメソッドに処理を委譲します。
...
Kernel.#test や FileTest のメソッドに処理を委譲します。
@param command 数値、またはサイズが 1 の文字列の場合は Kernel.#test に処理委譲します。
2 文字以上の文字列の場合は FileTest のメソッドとして実行します。
@para......。
@param file2 文字列でファイルへのパスを指定します。
require 'shell'
Shell.verbose = false
sh = Shell.new
begin
sh.mkdir("foo")
rescue
end
p sh[?e, "foo"] # => true
p sh[:e, "foo"] # => true
p sh["e", "foo"] # => true
p sh[:exist......s?, "foo"] # => true
p sh["exists?", "foo"] # => true
@see Kernel.#test, FileTest... -
Object
# freeze -> self (49.0) -
オブジェクトを凍結(内容の変更を禁止)します。
...数なら Kernel.#trace_var が使えます。
@return self を返します。
//emlist[][ruby]{
a1 = "foo".freeze
a1 = "bar"
p a1 #=> "bar"
a2 = "foo".freeze
a2.replace("bar") # can't modify frozen String (RuntimeError)
//}
凍結を解除することはできませんが、Object#dup を使え......ます。
//emlist[][ruby]{
a = [1].freeze
p a.frozen? #=> true
a[0] = "foo"
p a # can't modify frozen Array (RuntimeError)
b = a.dup
p b #=> [1]
p b.frozen? #=> false
b[0] = "foo"
p b #=> ["foo"]
//}
@see Object#frozen?,Object#dup,Kernel.#trace_var......数なら Kernel.#trace_var が使えます。
@return self を返します。
//emlist[][ruby]{
a1 = "foo".freeze
a1 = "bar"
p a1 #=> "bar"
a2 = "foo".freeze
a2.replace("bar") # can't modify frozen String (FrozenError)
//}
凍結を解除することはできませんが、Object#dup を使え......ます。
//emlist[][ruby]{
a = [1].freeze
p a.frozen? #=> true
a[0] = "foo"
p a # can't modify frozen Array (FrozenError)
b = a.dup
p b #=> [1]
p b.frozen? #=> false
b[0] = "foo"
p b #=> ["foo"]
//}
@see Object#frozen?,Object#dup,Kernel.#trace_var... -
Module
# autoload(const _ name , feature) -> nil (47.0) -
定数 const_name を最初に参照した時に feature を Kernel.#require するように設定します。
...定数 const_name を最初に参照した時に feature を Kernel.#require するように設定します。
const_name が autoload 設定されていて、まだ定義されてない(ロードされていない)ときは、
autoload する対象を置き換えます。
const_name が(autoload......しません。
@param const_name String または Symbol で指定します。
なお、const_name には、"::" 演算子を含めることはできません。
つまり、self の直下に定義された定数しか指定できません。
@param feature Kernel.#require と同様......tmp/foo.rb ---------
class Foo
class Bar
end
end
# ----- end of /tmp/foo.rb ----
class Foo
autoload :Bar, '/tmp/foo'
end
p Foo::Bar #=> Foo::Bar
//}
以下のようにモジュールを明示的にレシーバとして呼び出すこともできます。
//emlist[例][ruby]{
# ------- /tmp/... -
Object
# class -> Class (43.0) -
レシーバのクラスを返します。
...レシーバのクラスを返します。
//emlist[][ruby]{
p "ruby".class #=> String
p 100.class #=> Integer
p ARGV.class #=> Array
p self.class #=> Object
p Class.class #=> Class
p Kernel.class #=> Module
//}
@see Class#superclass,Object#kind_of?,Object#instance_of?... -
Module
# constants(inherit = true) -> [Symbol] (37.0) -
そのモジュール(またはクラス)で定義されている定数名の配列を返します。
...ません。
@param inherit true を指定するとスーパークラスや include したモジュールで
定義された定数が対象にはなります。false を指定した場合 対象にはなりません。
@see Module.constants, Kernel.#local_variables, Kernel.#global_variables......nd
class Bar
BAR = 1
# Bar は BAR を含む
p constants # => [:BAR]
# 出力に FOO は含まれない
p Module.constants - $clist # => [:BAR, :Bar, :Foo]
class Baz
# Baz は定数を含まない
p constants # => []
#......ネストしたクラスでは、外側のクラスで定義した定数は
# 参照可能なので、BAR は、Module.constants には含まれる
# (クラス Baz も Bar の定数なので同様)
p Module.constants - $clist # => [:BAR, :Baz, :Foo, :Bar]
end
end
//}... -
Object
# send(name , *args) -> object (37.0) -
オブジェクトのメソッド name を args を引数に して呼び出し、メソッドの実行結果を返します。
...ドを呼び出せます。
d:spec/def#limit も参照してください。
public メソッドだけ呼び出せれば良い場合は
Object#public_send を使う方が良いでしょう。
@param name 文字列かSymbol で指定するメソッド名です。
@param args 呼び出すメソッド......に渡す引数です。
//emlist[][ruby]{
p -365.send(:abs) #=> 365
p "ruby".send(:sub,/./,"R") #=> "Ruby"
class Foo
def foo() "foo" end
def bar() "bar" end
def baz() "baz" end
end
# 任意のキーとメソッド(の名前)の関係をハッシュに保持しておく
# レシーバの......ーバは任意(Foo クラスのインスタンスである必要もない)
p Foo.new.send(methods[1]) # => "foo"
p Foo.new.send(methods[2]) # => "bar"
p Foo.new.send(methods[3]) # => "baz"
//}
@see Object#public_send, BasicObject#__send__, Object#method, Kernel.#eval, Proc, Method... -
Object
# send(name , *args) { . . . . } -> object (37.0) -
オブジェクトのメソッド name を args を引数に して呼び出し、メソッドの実行結果を返します。
...ドを呼び出せます。
d:spec/def#limit も参照してください。
public メソッドだけ呼び出せれば良い場合は
Object#public_send を使う方が良いでしょう。
@param name 文字列かSymbol で指定するメソッド名です。
@param args 呼び出すメソッド......に渡す引数です。
//emlist[][ruby]{
p -365.send(:abs) #=> 365
p "ruby".send(:sub,/./,"R") #=> "Ruby"
class Foo
def foo() "foo" end
def bar() "bar" end
def baz() "baz" end
end
# 任意のキーとメソッド(の名前)の関係をハッシュに保持しておく
# レシーバの......ーバは任意(Foo クラスのインスタンスである必要もない)
p Foo.new.send(methods[1]) # => "foo"
p Foo.new.send(methods[2]) # => "bar"
p Foo.new.send(methods[3]) # => "baz"
//}
@see Object#public_send, BasicObject#__send__, Object#method, Kernel.#eval, Proc, Method... -
Module
# ancestors -> [Class , Module] (31.0) -
クラス、モジュールのスーパークラスとインクルードしているモジュール を優先順位順に配列に格納して返します。
...先順位順に配列に格納して返します。
//emlist[例][ruby]{
module Foo
end
class Bar
include Foo
end
class Baz < Bar
p ancestors
p included_modules
p superclass
end
# => [Baz, Bar, Foo, Object, Kernel, BasicObject]
# => [Foo, Kernel]
# => Bar
//}
@see Module#included_modules... -
Module
# const _ defined?(name , inherit = true) -> bool (31.0) -
モジュールに name で指定される名前の定数が定義されている時真 を返します。
...とができます。
@param name String, Symbol で指定される定数名。
@param inherit false を指定するとスーパークラスや include したモジュールで
定義された定数は対象にはなりません。
//emlist[例][ruby]{
module Kernel
FOO = 1
end
# Object......include したモジュールの定数に対しても
# true を返す
p Object.const_defined?(:FOO) # => true
module Bar
BAR = 1
end
class Object
include Bar
end
# ユーザ定義のモジュールに対しても同様
p Object.const_defined?(:BAR) # => true
class Baz
include Bar
end
#......Object 以外でも同様になった
# 第二引数のデフォルト値が true であるため
p Baz.const_defined?(:BAR) # => true
# 第二引数を false にした場合
p Baz.const_defined?(:BAR, false) # => false
//}...