クラス
-
ARGF
. class (55) - Array (140)
- Data (6)
- Encoding (44)
-
Encoding
:: Converter (55) - Enumerator (22)
-
Enumerator
:: Lazy (10) - IO (124)
- Integer (44)
- MatchData (48)
- Method (11)
- Module (38)
- Numeric (11)
- Object (55)
- Proc (5)
-
RubyVM
:: InstructionSequence (44) - String (26)
- Struct (9)
- Symbol (10)
- SystemCallError (11)
- Thread (22)
- Time (66)
モジュール
-
File
:: Constants (11) -
GC
:: Profiler (88) - Kernel (79)
- ObjectSpace (44)
- Process (33)
-
RubyVM
:: AbstractSyntaxTree (8)
キーワード
- === (33)
- ArgumentError (11)
-
CLOCK
_ PROF (11) - ConditionVariable (9)
- EDOOFUS (11)
- EOFError (11)
- EROFS (11)
- Mutex (9)
- NOFOLLOW (11)
- Profiler (11)
- Queue (9)
-
RLIMIT
_ NOFILE (11) - RegexpError (11)
-
SJIS
_ SOFTBANK (11) -
SJIS
_ SoftBank (11) - SizedQueue (9)
-
UTF8
_ SOFTBANK (11) -
UTF8
_ SoftBank (11) - [] (11)
- advise (11)
- autoload (22)
- autoload? (11)
-
base
_ label (11) - begin (11)
- binread (11)
- binwrite (11)
- byteindex (2)
- byteoffset (4)
- byterindex (2)
- chr (22)
- class (11)
- clear (11)
- coerce (11)
- combination (22)
-
const
_ set (11) -
copy
_ stream (11) -
deconstruct
_ keys (2) - digits (22)
- disable (11)
-
each
_ object (44) - enable (11)
- enabled? (11)
- end (11)
-
end
_ with? (5) - eof (22)
- eof? (22)
- exec (11)
- fetch (33)
-
first
_ lineno (11) - getlocal (11)
- gets (11)
-
gmt
_ offset (11) - gmtoff (11)
-
handle
_ interrupt (11) -
instance
_ of? (11) -
is
_ a? (11) -
kind
_ of? (11) - label (11)
- lambda (17)
- localtime (11)
- new (13)
- offset (22)
- pack (19)
- permutation (22)
- pread (7)
-
primitive
_ convert (44) -
primitive
_ errinfo (11) - proc (18)
- pwrite (7)
-
raw
_ data (11) - read (11)
- readbyte (11)
- readchar (11)
- readline (11)
-
repeated
_ combination (22) -
repeated
_ permutation (22) - report (11)
- result (11)
-
ruby2
_ keywords (10) - seek (22)
-
source
_ location (11) -
start
_ with? (5) - strftime (11)
- sysseek (11)
-
to
_ f (11) -
total
_ time (11) - unpack (11)
-
utc
_ offset (11) -
with
_ index (32) - write (11)
検索結果
先頭5件
- RubyVM
:: AbstractSyntaxTree . of(proc , keep _ script _ lines: false , error _ tolerant: false , keep _ tokens: false) -> RubyVM :: AbstractSyntaxTree :: Node - RubyVM
:: InstructionSequence . of(body) -> RubyVM :: InstructionSequence - RubyVM
:: AbstractSyntaxTree . of(proc) -> RubyVM :: AbstractSyntaxTree :: Node - Errno
:: EROFS - Object
# instance _ of?(klass) -> bool
-
RubyVM
:: AbstractSyntaxTree . of(proc , keep _ script _ lines: false , error _ tolerant: false , keep _ tokens: false) -> RubyVM :: AbstractSyntaxTree :: Node (29416.0) -
引数 proc に渡したProcやメソッドオブジェクトの抽象構文木を返します。
...ます。
@param keep_script_lines true を指定すると、 Node#script_lines でノードと関連づけられたソースコードのテキストを取得できます。
@param keep_tokens true を指定すると、 Node#token が利用できます。
@param error_tolerant true を指定する......と、構文エラーが発生した際にエラー箇所を type が :ERROR であるようなノードに置き換えてツリーを生成します。
//emlist[][ruby]{
pp RubyVM::AbstractSyntaxTree.of(proc {1 + 2})
# => (SCOPE@2:38-2:45
# tbl: []
# args: nil
# body:
# (OPCALL@2......def hello
puts "hello, world"
end
pp RubyVM::AbstractSyntaxTree.of(method(:hello))
# => (SCOPE@5:0-7:3
# tbl: []
# args:
# (ARGS@5:9-5:9
# pre_num: 0
# pre_init: nil
# opt: nil
# first_post: nil
# post_num: 0
# post_init: nil
# rest... -
RubyVM
:: InstructionSequence . of(body) -> RubyVM :: InstructionSequence (29239.0) -
引数 body で指定した Proc、Method オブジェクトを元に RubyVM::InstructionSequence オブジェクトを作成して返します。
...Proc、Method オブジェクトを元に
RubyVM::InstructionSequence オブジェクトを作成して返します。
@param body Proc、Method オブジェクトを指定します。
例1:irb で実行した場合
# proc
> p = proc { num = 1 + 2 }
> RubyVM::InstructionSequence.of(p)
>......ionSequence:block in irb_binding@(irb)>
# method
> def foo(bar); puts bar; end
> RubyVM::InstructionSequence.of(method(:foo))
> # => <RubyVM::InstructionSequence:foo@(irb)>
例2: RubyVM::InstructionSequence.compile_file を使用した場合
# /tmp/iseq_of.rb
def hello
puts "hello......, world"
end
$a_global_proc = proc { str = 'a' + 'b' }
# irb
> require '/tmp/iseq_of.rb'
# hello メソッド
> RubyVM::InstructionSequence.of(method(:hello))
> # => #<RubyVM::InstructionSequence:0x007fb73d7cb1d0>
# グローバル proc
> RubyVM::InstructionSequence.of($a_globa... -
RubyVM
:: AbstractSyntaxTree . of(proc) -> RubyVM :: AbstractSyntaxTree :: Node (29216.0) -
引数 proc に渡したProcやメソッドオブジェクトの抽象構文木を返します。
.../emlist[][ruby]{
pp RubyVM::AbstractSyntaxTree.of(proc {1 + 2})
# => (SCOPE@2:38-2:45
# tbl: []
# args: nil
# body:
# (OPCALL@2:39-2:44 (LIT@2:39-2:40 1) :+
# (LIST@2:43-2:44 (LIT@2:43-2:44 2) nil)))
def hello
puts "hello, world"
end
pp RubyVM::AbstractSyntaxTree.of(me......thod(:hello))
# => (SCOPE@5:0-7:3
# tbl: []
# args:
# (ARGS@5:9-5:9
# pre_num: 0
# pre_init: nil
# opt: nil
# first_post: nil
# post_num: 0
# post_init: nil
# rest: nil
# kw: nil
# kwrest: nil
# block: nil)
# bod......y:
# (FCALL@6:2-6:21 :puts (LIST@6:7-6:21 (STR@6:7-6:21 "hello, world") nil)))
//}......ます。
@param keep_script_lines true を指定すると、 Node#script_lines でノードと関連づけられたソースコードのテキストを取得できます。
@param keep_tokens true を指定すると、 Node#token が利用できます。
@param error_tolerant true を指定する......と、構文エラーが発生した際にエラー箇所を type が :ERROR であるようなノードに置き換えてツリーを生成します。
//emlist[][ruby]{
pp RubyVM::AbstractSyntaxTree.of(proc {1 + 2})
# => (SCOPE@2:38-2:45
# tbl: []
# args: nil
# body:
# (OPCALL@2......def hello
puts "hello, world"
end
pp RubyVM::AbstractSyntaxTree.of(method(:hello))
# => (SCOPE@5:0-7:3
# tbl: []
# args:
# (ARGS@5:9-5:9
# pre_num: 0
# pre_init: nil
# opt: nil
# first_post: nil
# post_num: 0
# post_init: nil
# rest... -
Errno
:: EROFS (23002.0) -
システムコールのエラーコードを表す例外クラスです。詳細は Errno::EXXX を参照してください。
...システムコールのエラーコードを表す例外クラスです。詳細は Errno::EXXX を参照してください。... -
Object
# instance _ of?(klass) -> bool (20233.0) -
オブジェクトがクラス klass の直接のインスタンスである時真を返します。
...ance_of?(c) が成立する時には、常に obj.kind_of?(c) も成立します。
@param klass Classかそのサブクラスのインスタンスです。
//emlist[][ruby]{
class C < Object
end
class S < C
end
obj = S.new
p obj.instance_of?(S) # true
p obj.instance_of?(C) # false
//......}
@see Object#kind_of?,Object#class... -
ARGF
. class # eof -> bool (20202.0) -
現在開いているファイルがEOFに達したらtrueを返します。そうでない場合は falseを返します。
...イルがEOFに達したらtrueを返します。そうでない場合は
falseを返します。
@raise IOError ファイルがopenされていない場合に発生します。
$ echo "eof" | ruby argf.rb
ARGF.eof? # => false
3.times { ARGF.readchar }
ARGF.eof?......# => false
ARGF.readchar # => "\n"
ARGF.eof? # => true
@see IO#eof, IO#eof?... -
ARGF
. class # eof? -> bool (20202.0) -
現在開いているファイルがEOFに達したらtrueを返します。そうでない場合は falseを返します。
...イルがEOFに達したらtrueを返します。そうでない場合は
falseを返します。
@raise IOError ファイルがopenされていない場合に発生します。
$ echo "eof" | ruby argf.rb
ARGF.eof? # => false
3.times { ARGF.readchar }
ARGF.eof?......# => false
ARGF.readchar # => "\n"
ARGF.eof? # => true
@see IO#eof, IO#eof?... -
IO
# eof -> bool (20202.0) -
ストリームがファイルの終端に達した場合、true を返します。そうでない場合、false を返します。
...達した場合、true を返します。そうでない場合、false を返します。
f = File.new("testfile")
dummy = f.readlines
f.eof #=> true
自身がパイプやソケットなどのストリームであった場合、相手がデータを送るか close するまでブロッ......pe
Thread.new { sleep 10; w.close }
r.eof? #=> 10秒ブロックしてから true を返す。
r, w = IO.pipe
Thread.new { sleep 10; w.puts "a" }
r.eof? #=> 10秒ブロックしてから false を返す。
r, w = IO.pipe
r.eof? # 永久にブロックします。
eof, eof?......は入力バッファにデータを読み込むので、IO#sysread と同時に使うと正常に
動作しません。
@raise IOError 自身が読み込み用にオープンされていなければ発生します。... -
IO
# eof? -> bool (20202.0) -
ストリームがファイルの終端に達した場合、true を返します。そうでない場合、false を返します。
...達した場合、true を返します。そうでない場合、false を返します。
f = File.new("testfile")
dummy = f.readlines
f.eof #=> true
自身がパイプやソケットなどのストリームであった場合、相手がデータを送るか close するまでブロッ......pe
Thread.new { sleep 10; w.close }
r.eof? #=> 10秒ブロックしてから true を返す。
r, w = IO.pipe
Thread.new { sleep 10; w.puts "a" }
r.eof? #=> 10秒ブロックしてから false を返す。
r, w = IO.pipe
r.eof? # 永久にブロックします。
eof, eof?......は入力バッファにデータを読み込むので、IO#sysread と同時に使うと正常に
動作しません。
@raise IOError 自身が読み込み用にオープンされていなければ発生します。... -
MatchData
# byteoffset(n) -> [Integer , Integer] | [nil , nil] (20202.0) -
n 番目の部分文字列のバイト単位のオフセットの 配列 [start, end] を返します。
...のオフセットの
配列 [start, end] を返します。
n番目の部分文字列がマッチしていなければ [nil, nil] を返します。
@param n 部分文字列を指定する数値
@raise IndexError 範囲外の n を指定した場合に発生します。
@see MatchData#offset... -
MatchData
# byteoffset(name) -> [Integer , Integer] | [nil , nil] (20202.0) -
name という名前付きグループに対応する部分文字列のバイト単位のオフセットの 配列 [start, end] を返します。
...name という名前付きグループに対応する部分文字列のバイト単位のオフセットの
配列 [start, end] を返します。
nameの名前付きグループにマッチした部分文字列がなければ
[nil, nil] を返します。
@param name 名前(シンボルか文字......se IndexError 正規表現中で定義されていない name を指定した場合に発生します。
//emlist[例][ruby]{
/(?<year>\d{4})年(?<month>\d{1,2})月(?:(?<day>\d{1,2})日)?/ =~ "2021年1月"
p $~.byteoffset('year') # => [0, 4]
p $~.byteoffset(:year) # => [0, 4]
p $~.byteoffset......('month') # => [7, 8]
p $~.byteoffset(:month) # => [7, 8]
p $~.byteoffset('day') # => [nil, nil]
p $~.byteoffset('century') # => `offset': undefined group name reference: century (IndexError)
//}
@see MatchData#offset... -
MatchData
# offset(n) -> [Integer , Integer] | [nil , nil] (20202.0) -
n 番目の部分文字列のオフセットの配列 [start, end] を返 します。
...ットの配列 [start, end] を返
します。
//emlist[例][ruby]{
[ self.begin(n), self.end(n) ]
//}
と同じです。n番目の部分文字列がマッチしていなければ
[nil, nil] を返します。
@param n 部分文字列を指定する数値
@raise IndexError 範囲外の n を......指定した場合に発生します。
@see MatchData#begin, MatchData#end......指定した場合に発生します。
@see MatchData#begin, MatchData#end, MatchData#offset...