クラス
モジュール
- GC (6)
- Kernel (109)
- ObjectSpace (12)
キーワード
- === (36)
- ARGF (12)
- DATA (12)
- ECONNREFUSED (12)
- ETOOMANYREFS (12)
- Hash (12)
- IO (12)
- Proc (12)
- Range (12)
- Refinement (4)
- Regexp (12)
-
_ id2ref (12) - ` (12)
-
abort
_ on _ exception (24) -
abort
_ on _ exception= (24) -
alias
_ method (12) -
at
_ exit (12) - binmode (12)
- binmode? (12)
- binwrite (12)
- captures (2)
- deconstruct (11)
-
deconstruct
_ keys (13) -
delete
_ prefix (8) -
delete
_ prefix! (8) -
deprecate
_ constant (12) - encoding (12)
- exit (12)
-
import
_ methods (4) - include? (12)
-
inplace
_ mode (12) -
inplace
_ mode= (12) -
instance
_ eval (24) - lambda (18)
- member? (12)
- print (12)
- printf (12)
- private (48)
- proc (19)
- protected (48)
- public (48)
- putc (12)
- puts (12)
- refine (12)
- send (24)
-
singleton
_ method _ undefined (12) -
source
_ location (7) -
start
_ with? (14) -
to
_ a (6) -
to
_ proc (12) -
to
_ write _ io (12) -
trace
_ var (36) - values (6)
-
verify
_ compaction _ references (6) - write (12)
検索結果
先頭5件
-
String
# delete _ prefix!(prefix) -> self | nil (6202.0) -
self の先頭から破壊的に prefix を削除します。
...prefix を削除します。
@param prefix 先頭から削除する文字列を指定します。
@return 削除した場合は self、変化しなかった場合は nil
//emlist[][ruby]{
"hello".delete_prefix!("hel") # => "lo"
"hello".delete_prefix!("llo") # => nil
//}
@see String#delete_prefi... -
String
# delete _ prefix(prefix) -> String (6202.0) -
文字列の先頭から prefix を削除した文字列のコピーを返します。
...ら prefix を削除した文字列のコピーを返します。
@param prefix 先頭から削除する文字列を指定します。
@return 文字列の先頭から prefix を削除した文字列のコピー
//emlist[][ruby]{
"hello".delete_prefix("hel") # => "lo"
"hello".delete_prefix("llo")......# => "hello"
//}
@see String#delete_prefix!
@see String#delete_suffix
@see String#start_with?... -
ObjectSpace
. # _ id2ref(id) -> object (6109.0) -
オブジェクト ID(BasicObject#__id__)からオブジェクトを得ます。
...id__)からオブジェクトを得ます。
@param id 取得したいオブジェクトの ID を整数で指定します。
@raise RangeError 対応するオブジェクトが存在しなければ発生します。
//emlist[例][ruby]{
a = "hoge"
p ObjectSpace._id2ref(a.__id__) #=> "hoge"
//}... -
GC
. verify _ compaction _ references(toward: nil , double _ heap: nil) -> Hash (6102.0) -
コンパクションの参照の一貫性を検証します。
コンパクションの参照の一貫性を検証します。
このメソッドは処理系依存 (CRuby 特有) です。
コンパクション中に移動されたオブジェクトは T_MOVED オブジェクトに置き換えられます。
コンパクション後には T_MOVED を参照するオブジェクトは存在するべきではありません。
この関数は全てのオブジェクトが移動する余地を確保するためにヒープを2倍にして、
全ての移動を確実にするためにヒープをコンパクションして、全ての参照を更新して、
それからフルGCを実行します。
もし T_MOVED への参照をもつオブジェクトがあれば、マークスタックにプッシュされて、
SEGV が起きるでしょ... -
Module
# refine(klass) { . . . } -> Module (6102.0) -
引数 klass で指定したクラスまたはモジュールだけに対して、ブロックで指定した機能を提供で きるモジュールを定義します。定義した機能は Module#refine を使用せずに直 接 klass に対して変更を行う場合と異なり、限られた範囲のみ有効にできます。 そのため、既存の機能を局所的に修正したい場合などに用いる事ができます。
...義した機能は Module#refine を使用せずに直
接 klass に対して変更を行う場合と異なり、限られた範囲のみ有効にできます。
そのため、既存の機能を局所的に修正したい場合などに用いる事ができます。
refinements 機能の詳細に......ついては以下を参照してください。
* https://magazine.rubyist.net/articles/0041/0041-200Special-refinement.html
* https://docs.ruby-lang.org/en/master/syntax/refinements_rdoc.html
定義した機能は main.using, Module#using を実行した場合のみ
有効になります。
@......指定した機能を持つ無名のモジュールを返します。
//emlist[例][ruby]{
class C
def foo
puts "C#foo"
end
end
module M
refine C do
def foo
puts "C#foo in M"
end
end
end
x = C.new
x.foo # => "C#foo"
using M
x = C.new
x.foo # => "C#foo in M"
//}
@see m... -
Errno
:: ECONNREFUSED (6002.0) -
システムコールのエラーコードを表す例外クラスです。詳細は Errno::EXXX を参照してください。
システムコールのエラーコードを表す例外クラスです。詳細は Errno::EXXX を参照してください。 -
Errno
:: ETOOMANYREFS (6002.0) -
システムコールのエラーコードを表す例外クラスです。詳細は Errno::EXXX を参照してください。
システムコールのエラーコードを表す例外クラスです。詳細は Errno::EXXX を参照してください。 -
Refinement (6002.0)
-
refine のブロックの中の self のクラスです。
...refine のブロックの中の self のクラスです。
Refinement#import_methodsで他のモジュールからメソッドを
インポートできます。... -
Refinement
# import _ methods(*modules) -> self (3002.0) -
モジュールからメソッドをインポートします。
...ールからメソッドをインポートします。
Module#includeと違って、import_methods はメソッドをコピーして
refinement に追加して、refinementでインポートしたメソッドを有効化します。
メソッドをコピーするため、Rubyコードで定義さ......mlist[][ruby]{
module StrUtils
def indent(level)
' ' * level + self
end
end
module M
refine String do
import_methods StrUtils
end
end
using M
p "foo".indent(3) # => " foo"
module M
refine String do
import_methods Enumerable
# Can't import method which is not defined wi... -
String
# start _ with?(*prefixes) -> bool (102.0) -
self の先頭が prefixes のいずれかであるとき true を返します。
...self の先頭が prefixes のいずれかであるとき true を返します。
@param prefixes パターンを表す文字列または正規表現 (のリスト)
//emlist[例][ruby]{
"string".start_with?("str") # => true
"string".start_with?("ing") # => false
"string".start_w......ith?("ing", "str") # => true
"string".start_with?(/\w/) # => true
"string".start_with?(/\d/) # => false
//}
@see String#end_with?
@see String#delete_prefix, String#delete_prefix!... -
Symbol
# start _ with?(*prefixes) -> bool (102.0) -
self の先頭が prefixes のいずれかであるとき true を返します。
...self の先頭が prefixes のいずれかであるとき true を返します。
(self.to_s.start_with?と同じです。)
@param prefixes パターンを表す文字列または正規表現 (のリスト)
@see Symbol#end_with?
@see String#start_with?
//emlist[][ruby]{
:hello.start_with?("hel......l") #=> true
:hello.start_with?(/H/i) #=> true
# returns true if one of the prefixes matches.
:hello.start_with?("heaven", "hell") #=> true
:hello.start_with?("heaven", "paradise") #=> false
//}... -
ARGF
. class # inplace _ mode -> String | nil (24.0) -
c:ARGF#inplace で書き換えるファイルのバックアップに付加される拡 張子を返します。拡張子が設定されていない場合は空文字列を返します。イン プレースモードでない場合は nil を返します。
c:ARGF#inplace で書き換えるファイルのバックアップに付加される拡
張子を返します。拡張子が設定されていない場合は空文字列を返します。イン
プレースモードでない場合は nil を返します。
Ruby 起動時の -i オプション や ARGF.class#inplace_mode= で設定します。
例:
# $ echo "test" > test.txt
# $ ruby -i.bak test.rb test.txt
# $ cat test.txt # => "TEST"
# $ cat test.txt.bak # => "test"
# test...