クラス
-
ARGF
. class (144) - Array (1564)
- BasicObject (168)
- Binding (36)
- Class (72)
- Complex (324)
- Data (36)
- Dir (485)
- Encoding (60)
-
Encoding
:: Converter (252) -
Encoding
:: InvalidByteSequenceError (12) - Enumerator (188)
-
Enumerator
:: Lazy (320) - Exception (104)
- FalseClass (36)
- Fiber (46)
- File (513)
-
File
:: Stat (96) - Float (363)
- FrozenError (6)
- Hash (848)
- IO (628)
- Integer (698)
- MatchData (206)
- Method (175)
- Module (852)
- Mutex (4)
- NilClass (67)
- Numeric (383)
- Object (725)
-
ObjectSpace
:: WeakMap (12) - Proc (36)
- Random (120)
- Range (336)
- Rational (291)
- Regexp (189)
- RubyVM (12)
-
RubyVM
:: AbstractSyntaxTree :: Node (14) -
RubyVM
:: InstructionSequence (210) - Set (108)
- SignalException (36)
- String (1906)
- Struct (180)
- Symbol (71)
- SystemCallError (12)
- Thread (268)
-
Thread
:: Backtrace :: Location (72) -
Thread
:: ConditionVariable (20) -
Thread
:: Mutex (20) -
Thread
:: Queue (38) -
Thread
:: SizedQueue (50) - ThreadGroup (12)
- Time (338)
- TracePoint (201)
- TrueClass (36)
- UnboundMethod (96)
モジュール
- Comparable (87)
- Enumerable (1130)
- FileTest (165)
- GC (84)
-
GC
:: Profiler (36) - Kernel (1068)
- Marshal (48)
- Math (252)
- ObjectSpace (120)
- Process (92)
-
RubyVM
:: AbstractSyntaxTree (30) -
RubyVM
:: MJIT (21) - Signal (24)
- Warning (4)
オブジェクト
- ENV (64)
キーワード
- ! (12)
- != (12)
- !~ (12)
-
$ -0 (12) -
$ -F (12) -
$ -I (12) -
$ -K (5) -
$ / (12) -
$ : (12) -
$ ; (12) -
$ > (12) -
$ KCODE (5) -
$ LOAD _ PATH (12) -
$ _ (12) -
$ stdout (12) - % (62)
- & (63)
- * (84)
- ** (48)
- + (94)
- +@ (10)
- - (87)
- -@ (43)
-
/ (47) - < (58)
- << (34)
- <= (58)
- <=> (126)
- == (222)
- === (83)
- =~ (40)
- > (58)
- >= (58)
- >> (19)
- BasicObject (12)
- Complex (14)
- ConditionVariable (10)
- DEBUG (12)
- DEBUG= (12)
- DEFAULT (7)
- Float (12)
-
INSTRUCTION
_ NAMES (12) - Integer (12)
- Location (12)
- Method (12)
- Rational (12)
- String (12)
- Thread (12)
- [] (285)
- []= (132)
- ^ (51)
-
_ _ id _ _ (12) -
_ _ send _ _ (24) -
_ dump (12) -
_ id2ref (12) -
_ load (12) - ` (12)
- abort (24)
-
abort
_ on _ exception (24) -
abort
_ on _ exception= (24) -
absolute
_ path (36) -
absolute
_ path? (6) - acos (12)
- add (15)
- add? (3)
-
add
_ trace _ func (12) - advise (12)
-
alias
_ method (12) - all? (45)
- allbits? (8)
- allocate (12)
- ancestors (12)
- angle (24)
- any? (39)
- anybits? (8)
-
append
_ as _ bytes (1) -
append
_ features (12) - arg (24)
- argv0 (12)
-
asciicompat
_ encoding (24) - asin (12)
- at (65)
-
at
_ exit (12) - atan (12)
- atan2 (12)
- atime (36)
- attr (36)
-
attr
_ accessor (12) -
attr
_ reader (12) -
attr
_ writer (12) - autoclose? (12)
- autoload (24)
- autoload? (24)
- backtrace (12)
-
backtrace
_ locations (36) -
base
_ label (24) - basename (12)
- begin (24)
- between? (12)
- bind (12)
-
bind
_ call (12) - binread (12)
- binwrite (12)
- birthtime (23)
-
bit
_ length (12) - broadcast (10)
- bsearch (48)
-
bsearch
_ index (20) - bytebegin (2)
- byteend (2)
- byteindex (3)
- byteoffset (6)
- byterindex (3)
- bytes (43)
- bytesize (12)
- byteslice (36)
- call (24)
-
callee
_ id (12) - caller (36)
-
caller
_ locations (24) - capitalize (12)
- capitalize! (12)
- captures (12)
- casecmp (24)
- casecmp? (18)
- catch (24)
- cbrt (12)
- ceil (54)
- ceildiv (3)
- center (12)
- chain (7)
- chars (24)
- chdir (36)
- children (30)
- chomp (24)
- chomp! (12)
- chop (24)
- chop! (12)
- chown (12)
- chr (36)
- chroot (12)
- chunk (36)
-
chunk
_ while (12) - clamp (15)
- class (12)
-
class
_ eval (24) -
class
_ exec (12) -
class
_ variable _ get (12) -
class
_ variable _ set (12) -
class
_ variables (12) - clone (27)
- close (10)
-
close
_ write (12) - codepoints (24)
- coerce (36)
- collect (60)
- collect! (27)
-
collect
_ concat (12) - combination (24)
- compact (13)
- compact! (9)
-
compare
_ by _ identity (12) -
compare
_ by _ identity? (12) - compatible? (12)
- compile (24)
-
compile
_ file (12) -
compile
_ option (12) -
compile
_ option= (12) - concat (42)
- conjugate (12)
-
const
_ defined? (12) -
const
_ get (12) -
const
_ missing (12) -
const
_ set (12) -
const
_ source _ location (12) - constants (24)
- convert (12)
- convpath (12)
-
copy
_ stream (24) - cos (12)
- count (84)
-
count
_ objects (12) - crypt (12)
- ctime (36)
- curry (34)
- cycle (36)
- deconstruct (11)
-
deconstruct
_ keys (13) - dedup (3)
- default (24)
- default= (12)
-
default
_ external (12) -
default
_ external= (12) -
default
_ internal= (12) -
default
_ proc (12) -
default
_ proc= (12) - define (6)
-
define
_ finalizer (24) -
define
_ method (24) -
define
_ singleton _ method (24) -
defined
_ class (12) - delete (111)
- delete! (12)
- delete? (3)
-
delete
_ at (12) -
delete
_ if (51) -
delete
_ prefix (8) -
delete
_ prefix! (8) -
delete
_ suffix (8) -
delete
_ suffix! (8) - denominator (48)
-
deprecate
_ constant (12) - deq (20)
-
destination
_ encoding (12) - detect (24)
- difference (10)
- dig (30)
- digits (24)
- directory? (12)
- dirname (12)
- disable (24)
- disasm (24)
- disassemble (24)
- disjoint? (3)
- display (12)
- div (24)
- divmod (24)
- downcase (12)
- downcase! (12)
- downto (24)
- drop (12)
-
drop
_ while (36) - dump (32)
- dup (15)
- each (192)
-
each
_ byte (48) -
each
_ char (36) -
each
_ child (46) -
each
_ codepoint (24) -
each
_ cons (24) -
each
_ entry (24) -
each
_ grapheme _ cluster (16) -
each
_ index (12) -
each
_ key (12) -
each
_ line (84) -
each
_ object (48) -
each
_ pair (12) -
each
_ slice (24) -
each
_ value (12) -
each
_ with _ index (24) -
each
_ with _ object (24) - empty? (18)
- enable (24)
- enabled? (7)
- encode (36)
- encode! (24)
- encoding (12)
- end (24)
-
end
_ with? (18) - entries (43)
-
enum
_ for (24) - eql? (159)
- equal? (36)
- erf (12)
- erfc (12)
-
error
_ bytes (12) - escape (12)
- eval (36)
-
eval
_ script (7) - event (12)
- except (8)
- exception (36)
- exec (48)
-
executable
_ real? (12) - exist? (12)
- exit (12)
- exit! (12)
- exp (12)
- extend (12)
-
extend
_ object (12) - extended (12)
- extname (12)
- fail (12)
- fcntl (12)
- fdatasync (12)
- fdiv (36)
- feed (12)
- fetch (80)
-
fetch
_ values (22) - fileno (23)
- fill (24)
- filter (63)
- filter! (28)
-
filter
_ map (18) - find (24)
-
find
_ all (36) -
find
_ index (72) - finish (12)
- finite? (18)
- first (72)
-
flat
_ map (12) - flatten (27)
- flatten! (15)
- flock (12)
- floor (54)
- fnmatch (12)
- fnmatch? (12)
-
for
_ fd (12) -
force
_ encoding (12) - foreach (72)
- fork (24)
- format (12)
- freeze (24)
- frexp (12)
- frozen? (12)
- ftype (12)
- gamma (12)
-
garbage
_ collect (24) - gcd (12)
- gcdlcm (12)
- getbyte (24)
- getc (12)
- getlocal (24)
- gets (48)
- getwd (12)
- glob (24)
- gm (24)
-
grapheme
_ clusters (16) - grep (36)
-
grep
_ v (34) - groups (12)
- grpowned? (12)
- gsub (84)
- gsub! (48)
- hash (27)
- hex (12)
- home (24)
- hypot (12)
- identical? (12)
-
ignore
_ deadlock= (4) - include? (15)
- index (55)
- infinite? (18)
- inherited (12)
- initialize (12)
-
initialize
_ copy (12) - inject (36)
-
inplace
_ mode (12) -
inplace
_ mode= (12) - insert (24)
-
insert
_ output (12) - inspect (151)
-
instance
_ eval (24) -
instance
_ exec (12) -
instance
_ method (12) -
instance
_ methods (12) -
instance
_ of? (12) -
instance
_ variable _ defined? (12) -
instance
_ variable _ get (12) -
instance
_ variable _ set (12) -
instance
_ variables (12) -
instruction
_ sequence (7) - integer? (12)
-
internal
_ encoding (12) - intersection (9)
- invert (12)
-
is
_ a? (12) - isatty (12)
- join (24)
-
keep
_ if (43) - key (12)
- key? (12)
- keys (12)
-
kind
_ of? (12) - label (24)
- last (48)
-
last
_ match (24) -
last
_ status (8) -
latest
_ gc _ info (24) - lazy (12)
- lchmod (12)
- lchown (12)
- lcm (12)
- ldexp (12)
- length (12)
- lgamma (12)
- lineno (12)
- lines (24)
- ljust (12)
- load (24)
-
load
_ from _ binary (10) -
load
_ from _ binary _ extra _ data (10) - local (24)
-
local
_ variable _ get (12) -
local
_ variable _ set (12) -
locale
_ charmap (12) - localtime (24)
- log (24)
- log10 (12)
- log2 (12)
- loop (24)
- lstat (24)
- lstrip (12)
- magnitude (12)
- map (60)
- map! (27)
-
marshal
_ dump (12) -
marshal
_ load (12) - match (48)
- match? (27)
- max (88)
- max= (10)
-
max
_ by (48) - member? (3)
- merge (27)
- merge! (24)
- method (12)
-
method
_ added (12) -
method
_ defined? (12) -
method
_ id (12) -
method
_ missing (12) -
method
_ removed (12) -
method
_ undefined (12) - methods (12)
- min (88)
-
min
_ by (48) - minmax (36)
-
minmax
_ by (24) - mkdir (12)
- mktime (24)
-
module
_ eval (24) -
module
_ exec (12) -
module
_ function (36) - modulo (36)
- mtime (36)
- name (17)
- name= (10)
-
named
_ captures (12) - negative? (29)
- new (401)
- next (24)
- next! (12)
-
next
_ float (11) -
next
_ values (12) - nobits? (8)
- none? (15)
- now (12)
- numerator (48)
-
object
_ id (12) - oct (12)
- of (22)
- offset (24)
- one? (45)
- open (108)
- ord (24)
-
original
_ name (24) - owned? (12)
- p (12)
- pack (21)
- parameters (31)
- parse (10)
-
parse
_ file (10) - partition (12)
- path (56)
- pause (7)
- peek (12)
-
peek
_ values (12) - permutation (24)
- phase (24)
- pid (12)
- polar (12)
- pop (32)
- pos (24)
- positive? (29)
-
post
_ match (12) - pow (24)
- pp (8)
-
pre
_ match (12) - pread (8)
- pred (12)
- prepend (21)
-
prepend
_ features (12) -
prev
_ float (11) -
primitive
_ convert (48) -
primitive
_ errinfo (12) - print (24)
- printf (24)
- priority (12)
- priority= (12)
- private (48)
-
private
_ class _ method (24) -
private
_ constant (12) -
private
_ instance _ methods (12) -
private
_ method _ defined? (12) - produce (6)
- product (24)
-
proper
_ subset? (3) -
proper
_ superset? (3) -
protected
_ method _ defined? (12) - public (12)
-
public
_ class _ method (24) -
public
_ constant (12) -
public
_ instance _ method (12) -
public
_ method (12) -
public
_ method _ defined? (12) -
public
_ send (24) - putback (24)
- putc (24)
- puts (12)
- pwd (12)
- pwrite (8)
- quo (36)
- quote (12)
- raise (30)
-
raised
_ exception (12) - rand (96)
- rationalize (108)
-
raw
_ data (12) -
raw
_ seed (2) - read (24)
- readable? (12)
- readbyte (24)
- readchar (12)
- readline (12)
- readlines (84)
- readlink (12)
- realpath (12)
- receiver (6)
- rect (36)
- rectangular (36)
- reduce (36)
- reject (84)
- reject! (51)
- remainder (24)
-
remove
_ class _ variable (12) -
remove
_ const (12) -
remove
_ instance _ variable (12) -
remove
_ method (12) - rename (12)
- reopen (24)
-
repeated
_ combination (24) -
repeated
_ permutation (24) - replace (27)
- replacement (12)
- replacement= (12)
- report (12)
-
report
_ on _ exception (9) -
report
_ on _ exception= (9) - require (12)
-
require
_ relative (12) -
respond
_ to? (12) -
respond
_ to _ missing? (12) - restore (12)
- result (12)
- resume (19)
-
return
_ value (12) -
reverse
_ each (28) - rewind (12)
- rindex (48)
- rjust (12)
- rmdir (12)
- rotate (12)
- rotate! (12)
- round (69)
- rpartition (12)
- rstrip (12)
- rstrip! (12)
- run (12)
- sample (24)
- scan (24)
- scrub (36)
- scrub! (36)
-
search
_ convpath (12) - select (108)
- select! (48)
- self (12)
- send (24)
-
set
_ backtrace (12) -
set
_ trace _ func (24) - setbyte (12)
- setgid? (12)
- setproctitle (12)
- setuid? (12)
- shift (56)
- signal (10)
- sin (12)
-
singleton
_ class (12) -
singleton
_ method (12) -
singleton
_ method _ added (12) -
singleton
_ method _ removed (12) -
singleton
_ method _ undefined (12) -
singleton
_ methods (12) - size (49)
- size? (12)
- sleep (36)
- slice (84)
- slice! (24)
-
slice
_ after (46) -
slice
_ before (60) -
slice
_ when (23) - socket? (12)
- sort (48)
- sort! (24)
-
sort
_ by (24) -
sort
_ by! (24) -
source
_ encoding (12) -
source
_ location (36) - spawn (48)
- split (31)
- sprintf (12)
- sqrt (20)
- squeeze (12)
- squeeze! (12)
- srand (24)
- start (12)
-
start
_ with? (18) - stat (48)
- step (124)
- sticky? (12)
- stop (12)
- stop? (12)
- store (24)
- stress= (12)
- strftime (12)
- strip (12)
- strip! (12)
- sub (60)
- sub! (36)
- subset? (3)
- subtract (3)
- succ (12)
- succ! (12)
- sum (54)
-
super
_ method (11) - superset? (3)
- swapcase (12)
- swapcase! (12)
- symlink? (24)
- synchronize (12)
- syscall (12)
- sysopen (12)
- system (48)
- syswrite (12)
- taint (9)
- tainted? (9)
- take (36)
-
take
_ while (72) - tally (8)
- tan (12)
- tap (8)
- tell (24)
- test (24)
- then (14)
-
thread
_ variable _ set (12) - throw (12)
- times (24)
-
to
_ a (73) -
to
_ ary (24) -
to
_ binary (10) -
to
_ c (12) -
to
_ enum (24) -
to
_ f (36) -
to
_ h (33) -
to
_ hash (12) -
to
_ i (60) -
to
_ int (12) -
to
_ path (8) -
to
_ proc (12) -
to
_ r (36) -
to
_ s (120) -
to
_ set (6) -
to
_ str (12) - tr (12)
-
tr
_ s (12) -
tr
_ s! (12) - trace (12)
-
trace
_ var (36) - transfer (4)
-
transform
_ keys (20) -
transform
_ keys! (20) -
transform
_ values (18) -
transform
_ values! (18) - trap (24)
- truncate (72)
- trust (9)
-
try
_ convert (16) - tty? (12)
- umask (24)
-
undef
_ method (12) -
undefine
_ finalizer (12) - undump (8)
-
unicode
_ normalize (11) -
unicode
_ normalize! (11) -
unicode
_ normalized? (11) - union (22)
- uniq (12)
- unlink (24)
- unpack (12)
- unpack1 (9)
- unshift (12)
- untaint (9)
-
untrace
_ var (12) - untrust (9)
- untrusted? (9)
- upcase (12)
- upcase! (12)
- update (24)
- upto (36)
- urandom (8)
- utc (24)
- utime (12)
- values (18)
-
values
_ at (48) - wait (12)
- wait2 (12)
- waitpid (12)
- waitpid2 (12)
- wakeup (12)
- warn (8)
- with (3)
-
with
_ index (12) -
with
_ object (24) -
world
_ readable? (12) -
world
_ writable? (12) - writable? (12)
- write (36)
- yield (12)
-
yield
_ self (16) - zero? (12)
- zip (72)
- | (63)
検索結果
先頭5件
-
Module
# protected _ method _ defined?(name , inherit=true) -> bool (12226.0) -
インスタンスメソッド name がモジュールに定義されており、 しかもその可視性が protected であるときに true を返します。 そうでなければ false を返します。
...ュールに定義されており、
しかもその可視性が protected であるときに true を返します。
そうでなければ false を返します。
@param name Symbol か String を指定します。
@param inherit 真を指定するとスーパークラスや include したモジ......。
@see Module#method_defined?, Module#public_method_defined?, Module#private_method_defined?
//emlist[例][ruby]{
module A
def method1() end
end
class B
protected
def method2() end
end
class C < B
include A
def method3() end
end
A.method_defined? :method1 #=> tru......e
C.protected_method_defined? "method1" #=> false
C.protected_method_defined? "method2" #=> true
C.protected_method_defined? "method2", true #=> true
C.protected_method_defined? "method2", false #=> false
C.method_defined? "method2" #=> true
//}... -
RubyVM
:: InstructionSequence . load _ from _ binary _ extra _ data(binary) -> String (12214.0) -
バイナリフォーマットの文字列から埋め込まれたextra_dataを取り出します。
...埋め込まれたextra_dataを取り出します。
//emlist[例][ruby]{
iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
binary = iseq.to_binary("extra_data")
RubyVM::InstructionSequence.load_from_binary_extra_data(binary) # => extra_data
//}
@see RubyVM::InstructionSequence#to_binary... -
RubyVM
:: AbstractSyntaxTree :: Node # inspect -> String (12114.0) -
self のデバッグ用の情報を含んだ文字列を返します。
...self のデバッグ用の情報を含んだ文字列を返します。
//emlist[][ruby]{
node = RubyVM::AbstractSyntaxTree.parse('1 + 1')
puts node.inspect
# => #<RubyVM::AbstractSyntaxTree::Node:SCOPE@1:0-1:5>
//}... -
Time
# strftime(format) -> String (9604.0) -
時刻を format 文字列に従って文字列に変換した結果を返します。
...時刻を format 文字列に従って文字列に変換した結果を返します。
@param format フォーマット文字列を指定します。使用できるものは 以下の通りです。
* %A: 曜日の名称(Sunday, Monday ... )
* %a: 曜日の省略名(Sun, Mon ... )
* %B: 月......の名称(January, February ... )
* %b: 月の省略名(Jan, Feb ... )
* %C: 世紀 (2009年であれば 20)
* %c: 日付と時刻 (%a %b %e %T %Y)
* %D: 日付 (%m/%d/%y)
* %d: 日(01-31)
* %e: 日。一桁の場合、半角空白で埋める ( 1..31)
* %F: %Y-%m-%d と同等 (ISO 860......0:00:00 UTC からの経過ミリ秒 (Time#strftime は対応していませんが、Date#strftime で使えます)
* %R: 24時間制の時刻。%H:%M と同等。
* %r: 12時間制の時刻。%I:%M:%S %p と同等。
* %S: 秒(00-60) (60はうるう秒)
* %s: 1970-01-01 00:00:00 UTC から... -
RubyVM
:: AbstractSyntaxTree . parse(string) -> RubyVM :: AbstractSyntaxTree :: Node (9528.0) -
文字列を抽象構文木にパースし、その木の根ノードを返します。
...します。
@param string パースする対象の Ruby のコードを文字列で指定します。
@param keep_script_lines true を指定すると、 Node#script_lines でノードと関連づけられたソースコードのテキストを取得できます。
@param keep_tokens true を指......すると、 Node#token が利用できます。
@param error_tolerant true を指定すると、構文エラーが発生した際にエラー箇所を type が :ERROR であるようなノードに置き換えてツリーを生成します。
@raise SyntaxError string が Ruby のコードとして......ist[][ruby]{
pp RubyVM::AbstractSyntaxTree.parse("x = 1 + 2")
# => (SCOPE@1:0-1:9
# tbl: [:x]
# args: nil
# body:
# (LASGN@1:0-1:9 :x
# (OPCALL@1:4-1:9 (LIT@1:4-1:5 1) :+ (LIST@1:8-1:9 (LIT@1:8-1:9 2) nil))))
pp RubyVM::AbstractSyntaxTree.parse("x = 1; p(x; y=2", error_tol... -
RubyVM
:: AbstractSyntaxTree . parse(string , keep _ script _ lines: false , error _ tolerant: false , keep _ tokens: false) -> RubyVM :: AbstractSyntaxTree :: Node (9528.0) -
文字列を抽象構文木にパースし、その木の根ノードを返します。
...します。
@param string パースする対象の Ruby のコードを文字列で指定します。
@param keep_script_lines true を指定すると、 Node#script_lines でノードと関連づけられたソースコードのテキストを取得できます。
@param keep_tokens true を指......すると、 Node#token が利用できます。
@param error_tolerant true を指定すると、構文エラーが発生した際にエラー箇所を type が :ERROR であるようなノードに置き換えてツリーを生成します。
@raise SyntaxError string が Ruby のコードとして......ist[][ruby]{
pp RubyVM::AbstractSyntaxTree.parse("x = 1 + 2")
# => (SCOPE@1:0-1:9
# tbl: [:x]
# args: nil
# body:
# (LASGN@1:0-1:9 :x
# (OPCALL@1:4-1:9 (LIT@1:4-1:5 1) :+ (LIST@1:8-1:9 (LIT@1:8-1:9 2) nil))))
pp RubyVM::AbstractSyntaxTree.parse("x = 1; p(x; y=2", error_tol... -
RubyVM
:: AbstractSyntaxTree . parse(string) -> RubyVM :: AbstractSyntaxTree :: Node (9468.0) -
文字列を抽象構文木にパースし、その木の根ノードを返します。
...す。
@param string パースする対象の Ruby のコードを文字列で指定します。
@raise SyntaxError string が Ruby のコードとして正しくない場合に発生します。
//emlist[][ruby]{
pp RubyVM::AbstractSyntaxTree.parse("x = 1 + 2")
# => (SCOPE@1:0-1:9
# tbl: [:x]......# args: nil
# body:
# (LASGN@1:0-1:9 :x
# (OPCALL@1:4-1:9 (LIT@1:4-1:5 1) :+ (LIST@1:8-1:9 (LIT@1:8-1:9 2) nil))))
//}... -
RubyVM
:: AbstractSyntaxTree . of(proc) -> RubyVM :: AbstractSyntaxTree :: Node (9392.0) -
引数 proc に渡したProcやメソッドオブジェクトの抽象構文木を返します。
...。
@param 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......llo
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: nil
#......kw: nil
# kwrest: nil
# block: nil)
# body:
# (FCALL@6:2-6:21 :puts (LIST@6:7-6:21 (STR@6:7-6:21 "hello, world") nil)))
//}......
@param proc Procもしくはメソッドオブジェクトを指定します。
@param keep_script_lines true を指定すると、 Node#script_lines でノードと関連づけられたソースコードのテキストを取得できます。
@param keep_tokens true を指定すると、 Node#tok......。
@param error_tolerant true を指定すると、構文エラーが発生した際にエラー箇所を type が :ERROR であるようなノードに置き換えてツリーを生成します。
//emlist[][ruby]{
pp RubyVM::AbstractSyntaxTree.of(proc {1 + 2})
# => (SCOPE@2:38-2:45
# tbl: []......ALL@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(method(:hello))
# => (SCOPE@5:0-7:3
# tbl: []
# args:
# (ARGS@5:9-5:9
# pre_num: 0
# pre_init: nil
# opt: n... -
TracePoint
# instruction _ sequence -> RubyVM :: InstructionSequence (9314.0) -
script_compiledイベント発生時にコンパイルされた RubyVM::InstructionSequenceインスタンスを返します。
...pt_compiledイベント発生時にコンパイルされた
RubyVM::InstructionSequenceインスタンスを返します。
//emlist[例][ruby]{
TracePoint.new(:script_compiled) do |tp|
p tp.instruction_sequence # => <RubyVM::InstructionSequence:block in <main>@(eval):1>
end.enable do
eval("put......s 'hello'")
end
//}
@raise RuntimeError :script_compiled イベントのための
イベントフックの外側で実行した場合に発生します。... -
RubyVM
:: AbstractSyntaxTree . of(proc , keep _ script _ lines: false , error _ tolerant: false , keep _ tokens: false) -> RubyVM :: AbstractSyntaxTree :: Node (9292.0) -
引数 proc に渡したProcやメソッドオブジェクトの抽象構文木を返します。
...
@param proc Procもしくはメソッドオブジェクトを指定します。
@param keep_script_lines true を指定すると、 Node#script_lines でノードと関連づけられたソースコードのテキストを取得できます。
@param keep_tokens true を指定すると、 Node#tok......。
@param error_tolerant true を指定すると、構文エラーが発生した際にエラー箇所を type が :ERROR であるようなノードに置き換えてツリーを生成します。
//emlist[][ruby]{
pp RubyVM::AbstractSyntaxTree.of(proc {1 + 2})
# => (SCOPE@2:38-2:45
# tbl: []......ALL@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(method(:hello))
# => (SCOPE@5:0-7:3
# tbl: []
# args:
# (ARGS@5:9-5:9
# pre_num: 0
# pre_init: nil
# opt: n... -
RubyVM
:: AbstractSyntaxTree . parse _ file(pathname) -> RubyVM :: AbstractSyntaxTree :: Node (9292.0) -
pathname のファイルを読み込み、その内容を抽象構文木にパースし、その木の根ノードを返します。
...pathname のファイルを読み込み、その内容を抽象構文木にパースし、その木の根ノードを返します。
@param pathname パースする対象のファイルパスを指定します
@param keep_script_lines true を指定すると、 Node#script_lines でノードと関......
@param keep_tokens true を指定すると、 Node#token が利用できます。
@param error_tolerant true を指定すると、構文エラーが発生した際にエラー箇所を type が :ERROR であるようなノードに置き換えてツリーを生成します。
@raise SyntaxError pat......文字列が Ruby のコードとして正しくない場合に発生します。
//emlist[][ruby]{
pp RubyVM::AbstractSyntaxTree.parse_file(__FILE__)
# => (SCOPE@1:0-1:50
# tbl: []
# args: nil
# body:
# (FCALL@1:0-1:50 :pp
# (LIST@1:3-1:50
# (CALL@1:3-1:50
#... -
RubyVM
:: AbstractSyntaxTree . parse _ file(pathname , keep _ script _ lines: false , error _ tolerant: false , keep _ tokens: false) -> RubyVM :: AbstractSyntaxTree :: Node (9292.0) -
pathname のファイルを読み込み、その内容を抽象構文木にパースし、その木の根ノードを返します。
...pathname のファイルを読み込み、その内容を抽象構文木にパースし、その木の根ノードを返します。
@param pathname パースする対象のファイルパスを指定します
@param keep_script_lines true を指定すると、 Node#script_lines でノードと関......
@param keep_tokens true を指定すると、 Node#token が利用できます。
@param error_tolerant true を指定すると、構文エラーが発生した際にエラー箇所を type が :ERROR であるようなノードに置き換えてツリーを生成します。
@raise SyntaxError pat......文字列が Ruby のコードとして正しくない場合に発生します。
//emlist[][ruby]{
pp RubyVM::AbstractSyntaxTree.parse_file(__FILE__)
# => (SCOPE@1:0-1:50
# tbl: []
# args: nil
# body:
# (FCALL@1:0-1:50 :pp
# (LIST@1:3-1:50
# (CALL@1:3-1:50
#... -
RubyVM
:: AbstractSyntaxTree . parse _ file(pathname) -> RubyVM :: AbstractSyntaxTree :: Node (9274.0) -
pathname のファイルを読み込み、その内容を抽象構文木にパースし、その木の根ノードを返します。
...pathname のファイルを読み込み、その内容を抽象構文木にパースし、その木の根ノードを返します。
@param pathname パースする対象のファイルパスを指定します
@raise SyntaxError pathname から取得された文字列が Ruby のコードとして......//emlist[][ruby]{
pp RubyVM::AbstractSyntaxTree.parse_file(__FILE__)
# => (SCOPE@1:0-1:50
# tbl: []
# args: nil
# body:
# (FCALL@1:0-1:50 :pp
# (LIST@1:3-1:50
# (CALL@1:3-1:50
# (COLON2@1:3-1:29 (CONST@1:3-1:9 :RubyVM) :AbstractSyntaxTree)
#......:parse_file (LIST@1:41-1:49 (STR@1:41-1:49 "") nil)) nil)))
//}... -
String
# tr(pattern , replace) -> String (9256.0) -
pattern 文字列に含まれる文字を検索し、 それを replace 文字列の対応する文字に置き換えます。
...pattern 文字列に含まれる文字を検索し、
それを replace 文字列の対応する文字に置き換えます。
pattern の形式は tr(1) と同じです。つまり、
`a-c' は a から c を意味し、"^0-9" のように
文字列の先頭が `^' の場合は指定文字以外......囲が pattern の範囲よりも小さい場合は、
replace の最後の文字が無限に続くものとして扱われます。
@param pattern 置き換える文字のパターン
@param replace pattern で指定した文字を置き換える文字
//emlist[例][ruby]{
p "foo".tr("f", "......oo"
p "foo".tr('a-z', 'A-Z') # => "FOO"
p "FOO".tr('A-Z', 'a-z') # => "foo"
# シーザー暗号の復号
p "ORYV".tr("A-Z", "D-ZA-C") # => "RUBY"
# 全角英数字といくつかの記号の半角化
email = "ruby−lang@example.com"
p email.tr("0-9... -
ObjectSpace
. # count _ objects(result _ hash = {}) -> Hash (9244.0) -
オブジェクトを種類ごとにカウントした結果を Hash として返します。
...ドは C Ruby 以外の Ruby では動かないでしょう。
@param result_hash ハッシュを指定します。与えられたハッシュは上書きして返されます。
これを利用すると測定による影響を避けることができます。
@raise TypeError......引数に Hash 以外を与えた場合、発生します。
//emlist[例][ruby]{
ObjectSpace.count_objects # => {:TOTAL=>10000, :FREE=>3011, :T_OBJECT=>6, :T_CLASS=>404, ...}
//}...