種類
ライブラリ
- English (276)
- ビルトイン (2696)
- bigdecimal (16)
- continuation (12)
- delegate (12)
- digest (12)
- e2mmap (18)
-
irb
/ cmd / load (12) -
irb
/ xmp (24) - json (24)
-
minitest
/ unit (1) - mkmf (624)
- open-uri (80)
- open3 (24)
- openssl (24)
- pathname (24)
- pp (16)
- profiler (6)
- psych (24)
- pty (48)
- rake (36)
-
rubygems
/ custom _ require (12) - scanf (12)
- shell (12)
-
shell
/ command-processor (18) -
shell
/ filter (12) - socket (72)
- stringio (108)
- syslog (12)
- tempfile (55)
-
test
/ unit (1) - timeout (29)
- tracer (12)
- un (72)
- win32ole (12)
- zlib (48)
クラス
-
ARGF
. class (75) - Array (48)
- BasicObject (24)
- BigDecimal (2)
- Binding (12)
- Complex (24)
- Exception (24)
- File (36)
- IO (468)
-
IRB
:: ExtendCommand :: Load (12) - LoadError (12)
- Module (144)
- Object (168)
-
OpenSSL
:: BN (12) - Proc (19)
- Shell (12)
-
Shell
:: CommandProcessor (18) -
Shell
:: Filter (12) - Socket (36)
- String (72)
- StringIO (108)
- SystemExit (12)
- Tempfile (55)
- Thread (72)
- TracePoint (12)
- Tracer (12)
- UncaughtThrowError (22)
-
WIN32OLE
_ EVENT (12) - XMP (12)
-
Zlib
:: GzipWriter (48)
モジュール
- Exception2MessageMapper (18)
- FileTest (12)
- Kernel (2478)
-
MiniTest
:: Assertions (1) - Open3 (24)
-
OpenSSL
:: Buffering (12) - OpenURI (24)
-
OpenURI
:: OpenRead (24) - PTY (48)
- Process (96)
-
Socket
:: Constants (36) - Syslog (12)
-
Test
:: Unit (1) - Timeout (21)
- URI (16)
キーワード
-
$ ! (12) -
$ & (12) -
$ & # 39; (12) -
$ -F (12) -
$ -I (6) -
$ -p (12) -
$ 1 (12) -
$ 10 (12) -
$ 11 (12) -
$ 2 (12) -
$ 3 (12) -
$ 4 (12) -
$ 5 (12) -
$ 6 (12) -
$ 7 (12) -
$ 8 (12) -
$ 9 (12) -
$ : (6) -
$ ; (12) -
$ > (12) -
$ ? (12) -
$ ARGV (12) -
$ CHILD _ STATUS (12) -
$ DEFAULT _ INPUT (12) -
$ DEFAULT _ OUTPUT (12) -
$ ERROR _ INFO (12) -
$ ERROR _ POSITION (12) -
$ FIELD _ SEPARATOR (12) -
$ FS (12) -
$ INPUT _ LINE _ NUMBER (12) -
$ INPUT _ RECORD _ SEPARATOR (12) -
$ LAST _ MATCH _ INFO (12) -
$ LAST _ PAREN _ MATCH (12) -
$ LAST _ READ _ LINE (12) -
$ LOAD _ PATH (12) -
$ MATCH (12) -
$ NR (12) -
$ OFS (12) -
$ OUTPUT _ FIELD _ SEPARATOR (12) -
$ OUTPUT _ RECORD _ SEPARATOR (12) -
$ PID (12) -
$ POSTMATCH (12) -
$ PREMATCH (12) -
$ PROCESS _ ID (12) -
$ PROGRAM _ NAME (12) -
$ RS (12) -
$ ` (12) -
$ stdin (12) -
$ stdout (12) -
$ topdir (12) -
$ ~ (12) - % (12)
-
AI
_ V4MAPPED _ CFG (24) - ARGF (12)
- BigDecimal (14)
- Complex (36)
- Continuation (12)
- DATA (12)
- DelegateClass (12)
- Digest (12)
- Float (12)
- Integer (12)
- JSON (12)
-
NEWS for Ruby 2
. 4 . 0 (9) -
NEWS for Ruby 2
. 5 . 0 (8) -
NEWS for Ruby 2
. 7 . 0 (6) -
NEWS for Ruby 3
. 0 . 0 (5) -
NEWS for Ruby 3
. 1 . 0 (4) - Pathname (24)
- Proc (12)
-
Profiler
_ _ (6) - Rational (7)
- Rubyの起動 (12)
-
SCRIPT
_ LINES _ _ (12) -
SO
_ ATTACH _ FILTER (24) -
SO
_ DETACH _ FILTER (24) - String (12)
- TracePoint (12)
- Win32ネイティブ版Rubyの互換性問題 (12)
- [] (18)
-
_ _ callee _ _ (12) -
_ _ method _ _ (12) - abort (24)
-
add
_ filter (12) -
add
_ trace _ func (12) - ancestors (12)
-
at
_ exit (12) - autoload (24)
- autoload? (12)
- bigdecimal (12)
- binding (12)
- binread (12)
- binwrite (12)
- caller (36)
-
caller
_ locations (24) - catch (24)
-
cc
_ command (12) -
check
_ signedness (24) -
check
_ sizeof (24) - chomp (12)
- chop (12)
- class (12)
-
class
_ eval (24) -
const
_ defined? (12) - constants (24)
-
convertible
_ int (24) - cp (12)
- create (22)
-
create
_ makefile (12) -
create
_ tmpsrc (12) -
def
_ exception (6) -
defined
_ class (12) -
depend
_ rules (12) - desc (12)
-
drb
/ extservm (12) -
egrep
_ cpp (24) - eval (36)
- exception (24)
- exec (48)
- execute (12)
- exit (24)
- exit! (12)
- fail (36)
-
find
_ executable (12) -
find
_ header (12) -
find
_ library (24) -
find
_ type (24) -
for
_ fd (12) - foreach (24)
- fork (24)
- format (12)
- freeze (12)
- getpty (24)
- gets (39)
-
global
_ variables (12) - gsub (36)
-
have
_ header (24) -
have
_ macro (24) -
have
_ struct _ member (24) -
have
_ type (24) - help (12)
- hex (12)
- httpd (12)
- identical? (12)
- import (12)
- include (12)
- inspect (12)
- install (12)
-
install
_ files (12) -
instance
_ eval (24) -
instance
_ variables (12) - irb (12)
-
irb
/ xmp (12) - j (12)
- kill (24)
- lambda (18)
- libpathflag (12)
-
link
_ command (12) - load (12)
-
local
_ variables (12) - log (12)
- loop (24)
- method (12)
- mkdir (12)
-
module
_ eval (24) - namespace (12)
- new (80)
- oct (12)
- open (174)
- open-uri (6)
-
open
_ uri (24) - p (12)
- path (12)
- popen (168)
- popen3 (24)
- pp (24)
-
pretty
_ print (24) - print (72)
- printf (84)
- proc (19)
-
psych
_ y (12) -
public
_ instance _ method (12) - putc (48)
- puts (60)
- raise (48)
-
rb
_ exec _ end _ proc (12) -
rb
_ load (12) - read (36)
- readline (12)
- readlines (48)
- rect (12)
- rectangular (12)
-
remove
_ const (12) - reopen (60)
- require (12)
-
require
_ relative (12) - rmdir (12)
-
ruby 1
. 6 feature (12) -
ruby 1
. 8 . 2 feature (12) -
ruby 1
. 8 . 4 feature (12) -
ruby 1
. 9 feature (12) -
run
_ config (6) - sample (48)
- scanf (12)
- select (24)
- send (24)
-
set
_ trace _ func (24) -
setup
_ argv (1) - skip (1)
- sleep (24)
- spawn (84)
- sprintf (12)
- sprintf フォーマット (12)
- srand (24)
- status (12)
- sub (24)
- sysopen (12)
- system (48)
- tag (11)
- terminate (12)
- test (42)
-
to
_ a (12) -
to
_ ary (12) -
to
_ f (12) -
to
_ i (12) -
to
_ int (12) -
to
_ str (12) -
trace
_ var (36) - trap (24)
-
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) -
untrace
_ var (12) - value (11)
- warn (8)
-
webrick
/ https (12) -
webrick
/ httpservlet (12) -
with
_ werror (24) - write (24)
- xmp (12)
- xpopen (24)
- xsystem (12)
- y (12)
- このマニュアルのヘルプ (12)
- クラス/メソッドの定義 (12)
- セキュリティモデル (12)
- 制御構造 (12)
- 変数と定数 (12)
- 手続きオブジェクトの挙動の詳細 (12)
- 環境変数 (12)
- 終了処理 (12)
検索結果
先頭5件
-
Object
# class -> Class (42.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?... -
FileTest
. # identical?(file1 , file2) -> bool (36.0) -
file1 と file2 が同じファイルを指している時に真を返します。 そうでない場合、ファイルが存在しない場合、あるいはシステムコールに失敗した場合などには false を返します。
...y 1.8.3 以前ではKernel.#test(?-, file1, file2)を使ってください。
open("a", "w") {}
p File.identical?("a", "a") #=> true
p File.identical?("a", "./a") #=> true
File.link("a", "b")
p File.identical?("a", "b") #=> true
File.symlink("a", "c")
p File.identical?("a......", "c") #=> true
open("d", "w") {}
p File.identical?("a", "d") #=> false
@param file1 ファイル名を表す文字列か IO オブジェクトを指定します。
@param file2 ファイル名を表す文字列か IO オブジェクトを指定します。
@raise IOError 指定さ... -
Module
# constants(inherit = true) -> [Symbol] (36.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
//}... -
NEWS for Ruby 3
. 1 . 0 (36.0) -
NEWS for Ruby 3.1.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...した。 17411
//emlist{
Prime.each_cons(2).lazy.find_all{_1 in [n, ^(n + 2)]}.take(3).to_a
#=> [[3, 5], [5, 7], [11, 13]]
//}
* ピン演算子がインスタンス変数、クラス変数、グローバル変数をサポートしました。 17724
//emlist{
@n = 5
Prime.each_cons(2).lazy.fin......7592
* 1行のメソッド定義が括弧なしで書けるようになりました。例として def foo = puts "Hello" と記述できるようになりました。 private def foo = puts "Hello" はパースされないことに注意してください。 17398
== コマンドラインオプ......のコードでは使用しないでください。 17684
== 組み込みクラスの更新(注目すべきもののみ)
* Array
* 新規メソッド
* Array#intersect?が追加されました。 15198
* Class
* 新規メソッド
* Class#subclassesはレシーバを継承... -
Object
# send(name , *args) -> object (36.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 (36.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... -
irb (36.0)
-
irb は Interactive Ruby の略です。 irb を使うと、Ruby の式を標準入力から簡単に入力・実行することができます。
...行され、結果が表示されます。
irb(main):001:0> 1+2
3
irb(main):002:0> class Foo
irb(main):003:1> def foo
irb(main):004:2> print 1
irb(main):005:2> end
irb(main):006:1> end
:foo
irb(main):007:0>
また irb コマンドは readline ライブラリにも対応......マンドライン編集や履歴の機能が使えるようになります。
=== irb のコマンドラインオプション
irb [options] file_name opts
options:
-f ~/.irbrc を読み込まない
-m bc モード (分数と行列の計算ができる)
-d......示する (デフォルト)
--noecho 実行結果を表示しない
--inspect 結果出力にinspectを用いる (bc モード以外ではデフォルト)
--noinspect 結果出力にinspectを用いない
--readline readlineライブラリを利用する
--nor......マンドライン編集や履歴の機能が使えるようになります。
=== irb のコマンドラインオプション
irb [options] file_name opts
options:
-f ~/.irbrc を読み込まない
-d $DEBUG を true にする (ruby -d と同じ)
-w......実行結果を表示する (デフォルト)
--noecho 実行結果を表示しない
--inspect 結果出力にinspectを用いる
--noinspect 結果出力にinspectを用いない
--readline readlineライブラリを利用する
--noreadline readline... -
Module
# ancestors -> [Class , Module] (30.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 (30.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
//}... -
Thread
# exit -> self (30.0) -
スレッドの実行を終了させます。終了時に ensure 節が実行されます。
...スを Kernel.#exit(0)
により終了します。
Kernel.#exit と違い例外 SystemExit を発生しません。
th1 = Thread.new do
begin
sleep 10
ensure
p "this will be displayed"
end
end
sleep 0.1
th1.kill
#=> "this will be displayed"
@see Kernel.#exit,...