別のキーワード
クラス
-
ARGF
. class (36) - Array (245)
- BasicObject (144)
- Binding (48)
- Class (32)
- Data (6)
- Dir (48)
-
Encoding
:: Converter (48) -
Encoding
:: InvalidByteSequenceError (12) - Enumerator (120)
- Exception (80)
- Fiber (34)
- File (36)
- FrozenError (6)
- Hash (74)
- IO (256)
- Integer (23)
- MatchData (104)
- Method (139)
- Module (948)
- Mutex (4)
- Numeric (105)
- Object (420)
- Proc (62)
- Random (36)
- Range (124)
- Regexp (48)
-
RubyVM
:: InstructionSequence (48) - String (194)
- Symbol (12)
- Thread (72)
-
Thread
:: Backtrace :: Location (48) -
Thread
:: ConditionVariable (20) -
Thread
:: Mutex (20) -
Thread
:: Queue (30) -
Thread
:: SizedQueue (30) - Time (2)
- TracePoint (165)
- UnboundMethod (24)
モジュール
- Comparable (12)
- Enumerable (244)
キーワード
- ! (12)
- != (12)
- % (12)
-
/ (11) - < (12)
- << (14)
- <= (12)
- <=> (12)
- == (48)
- === (75)
- =~ (12)
- > (12)
- >= (12)
- >> (14)
- [] (120)
- []= (36)
-
_ _ send _ _ (24) -
_ dump (12) -
absolute
_ path (24) -
add
_ trace _ func (12) -
alias
_ method (12) - allocate (12)
- ancestors (12)
- append (8)
-
append
_ as _ bytes (1) -
append
_ features (12) - at (12)
- attr (36)
-
attr
_ accessor (12) -
attr
_ reader (12) -
attr
_ writer (12) - autoclose? (12)
- autoload (12)
- backtrace (12)
-
backtrace
_ locations (12) -
base
_ label (24) - begin (24)
- bind (12)
- binmode (12)
- broadcast (10)
- byteend (2)
- byteoffset (6)
- call (36)
-
callee
_ id (12) - chunk (12)
- clamp (12)
-
class
_ eval (24) -
class
_ exec (12) -
class
_ variable _ defined? (12) -
class
_ variable _ get (12) -
class
_ variable _ set (12) -
class
_ variables (12) - clone (24)
-
close
_ read (12) -
close
_ write (12) - coerce (12)
- compact (4)
-
const
_ defined? (12) -
const
_ get (12) -
const
_ missing (12) -
const
_ set (12) -
const
_ source _ location (12) - constants (12)
- cover? (19)
- crypt (12)
- curry (22)
- deconstruct (3)
-
deconstruct
_ keys (5) -
default
_ proc= (12) -
define
_ method (24) -
define
_ singleton _ method (24) -
defined
_ class (12) -
delete
_ suffix (8) -
delete
_ suffix! (8) - deq (20)
- disable (24)
- display (12)
- div (12)
- dup (24)
- each (72)
-
each
_ byte (48) -
each
_ entry (24) -
each
_ index (24) -
each
_ line (24) -
each
_ with _ index (24) - enable (24)
-
end
_ with? (18) -
enum
_ for (24) - eql? (12)
-
error
_ bytes (12) - eval (12)
-
eval
_ script (7) - event (12)
- exception (24)
- extend (12)
-
extend
_ object (12) - extended (12)
- fcntl (12)
- fdatasync (12)
- feed (12)
- fetch (36)
- first (24)
- flush (12)
- freeze (12)
- include (12)
- include? (12)
- included (12)
-
included
_ modules (12) - inherited (12)
- initialize (12)
-
initialize
_ copy (12) -
inplace
_ mode= (12) - inspect (48)
-
instance
_ eval (24) -
instance
_ exec (12) -
instance
_ method (12) -
instance
_ methods (12) -
instance
_ of? (12) -
instance
_ variable _ defined? (12) -
instance
_ variable _ get (12) -
instruction
_ sequence (7) - invert (12)
-
is
_ a? (12) -
kind
_ of? (12) - label (12)
- last (24)
- lazy (12)
- lineno (12)
-
local
_ variable _ defined? (12) -
local
_ variable _ get (12) -
local
_ variable _ set (12) - lstat (12)
-
marshal
_ dump (12) - match (24)
- max (48)
-
max
_ by (48) - merge (24)
-
method
_ added (12) -
method
_ defined? (12) -
method
_ id (12) -
method
_ missing (12) -
method
_ removed (12) -
method
_ undefined (12) - methods (12)
- min (48)
-
module
_ eval (24) -
module
_ exec (12) -
module
_ function (36) - name (12)
- next (12)
-
next
_ values (12) - offset (24)
-
original
_ name (24) - overlap? (2)
- pack (21)
- parameters (7)
- path (24)
-
peek
_ values (12) - pid (12)
- pop (20)
- pos (12)
- pos= (24)
- pread (8)
- prepend (41)
-
prepend
_ features (12) - prepended (12)
-
primitive
_ convert (48) - priority (12)
- priority= (12)
- private (48)
-
private
_ class _ method (24) -
private
_ constant (12) -
private
_ instance _ methods (12) -
private
_ method _ defined? (12) -
protected
_ method _ defined? (12) - public (48)
-
public
_ class _ method (24) -
public
_ constant (12) -
public
_ method _ defined? (12) -
public
_ send (24) - push (8)
- pwrite (8)
- raise (18)
-
raised
_ exception (12) - rand (36)
- read (12)
- readbyte (24)
- readchar (12)
- receiver (6)
- refine (12)
-
remove
_ class _ variable (12) -
remove
_ const (12) -
remove
_ instance _ variable (12) -
remove
_ method (12) - replace (12)
-
respond
_ to? (12) -
respond
_ to _ missing? (12) - resume (12)
-
return
_ value (12) - rewind (12)
- seek (12)
- send (24)
-
set
_ backtrace (12) -
set
_ trace _ func (12) - shift (20)
- signal (10)
-
singleton
_ method (12) -
singleton
_ method _ added (12) -
singleton
_ method _ removed (12) -
singleton
_ method _ undefined (12) -
singleton
_ methods (12) - size (12)
- sleep (12)
-
sort
_ by (24) -
source
_ location (12) -
start
_ with? (18) - stat (12)
- step (93)
- subclasses (4)
- sum (12)
-
super
_ method (11) - superclass (4)
- sync (12)
- synchronize (12)
- syswrite (12)
- tell (12)
-
thread
_ variable _ set (12) -
to
_ a (12) -
to
_ ary (24) -
to
_ enum (24) -
to
_ h (14) -
to
_ int (12) -
to
_ s (48) -
to
_ str (12) - transfer (4)
- truncate (12)
-
undef
_ method (12) - unpack (12)
- unshift (8)
- upto (12)
-
with
_ object (24) - write (12)
- yield (12)
検索結果
先頭5件
-
MatchData
# end(n) -> Integer | nil (18164.0) -
n 番目の部分文字列終端のオフセットを返します。
...。
@param n 部分文字列を指定する数値。
@raise IndexError 範囲外の n を指定した場合に発生します。
//emlist[例][ruby]{
/(foo)(bar)(BAZ)?/ =~ "foobarbaz"
p $~.end(0) # => 6
p $~.end(1) # => 3
p $~.end(2) # => 6
p $~.end(3) # => nil
p $~.end(4) # => `end': i......ndex 4 out of matches (IndexError)
//}
@see MatchData#begin... -
Range
# end -> object (18122.0) -
終端の要素を返します。範囲オブジェクトが終端を含むかどうかは関係ありま せん。
...終端の要素を返します。範囲オブジェクトが終端を含むかどうかは関係ありま
せん。
//emlist[例][ruby]{
(10..20).last # => 20
(10...20).last # => 20
//}
@see Range#begin... -
Module
# prepend(*modules) -> self (6169.0) -
指定したモジュールを self の継承チェインの先頭に「追加する」ことで self の定数、メソッド、モジュール変数を「上書き」します。
...を処理するため、prependの引数として
渡したモジュールのインスタンスメソッドでsuperを呼ぶことで
self のモジュール/クラスのメソッドを呼び出すことができます。
実際の処理は modules の各要素の prepend_features を後ろから......e#prepend_features が継承チェインの改変を実行し、結果として上のような
処理が実現されます。そのため、prepend_features を override することで
prepend の処理を追加/変更できます。
@param modules prepend する Module を指定します
@see Mo......dule#prepend_features, Module#prepended
//emlist[例][ruby]{
# super と prepend の組み合わせの例
module X
def foo
puts "X1" # (1x)
super # (2x)
puts "X2" # (3x)
end
end
class A
prepend X
def foo
puts "A" #(1a)
end
end
A.new.foo
# (1x) (2x)(ここの super で A... -
Object
# extend(*modules) -> self (6169.0) -
引数で指定したモジュールのインスタンスメソッドを self の特異 メソッドとして追加します。
...を追加します
が、extend は、ある特定のオブジェクトだけにモジュールの機能を追加
したいときに使用します。
引数に複数のモジュールを指定した場合、最後
の引数から逆順に extend を行います。
@param modules モジュール......スは不可)。
@return self を返します。
//emlist[][ruby]{
module Foo
def a
'ok Foo'
end
end
module Bar
def b
'ok Bar'
end
end
obj = Object.new
obj.extend Foo, Bar
p obj.a #=> "ok Foo"
p obj.b #=> "ok Bar"
class Klass
include Foo
extend Bar
end
p Klass.new.a #=> "o....../}
extend の機能は、「特異クラスに対する Module#include」
と言い替えることもできます。
ただしその場合、フック用のメソッド
が Module#extended ではなく Module#included になるという違いがあります。
//emlist[][ruby]{
# obj.extend Foo, B... -
Module
# prepend _ features(mod) -> self (6163.0) -
Module#prepend から呼び出されるメソッドで、 prepend の処理の実体です。このメソッド自体は mod で指定した モジュール/クラスの継承チェインの先頭に self を追加します。
...Module#prepend から呼び出されるメソッドで、
prepend の処理の実体です。このメソッド自体は mod で指定した
モジュール/クラスの継承チェインの先頭に self を追加します。
このメソッドを上書きすることで、prepend の処理を変......
@param mod prepend を呼び出したモジュール
@return mod が返されます
//emlist[例][ruby]{
class Recorder
RECORDS = []
end
module X
def self.prepend_features(mod)
Recorder::RECORDS << mod
end
end
class A
prepend X
end
class B
include X
end
class C
prepend X
end......Recorder::RECORDS # => [A, C]
//}
@see Module#prepend, Module#prepended... -
Object
# send(name , *args) -> object (6163.0) -
オブジェクトのメソッド name を args を引数に して呼び出し、メソッドの実行結果を返します。
...クもそのまま引き渡します。
send が再定義された場合に備えて別名 __send__ も
用意されており、ライブラリではこちらを使うべきです。また
__send__ は再定義すべきではありません。
send, __send__ は、メソッドの呼び出し制限......lic_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
d......ef bar() "bar" end
def baz() "baz" end
end
# 任意のキーとメソッド(の名前)の関係をハッシュに保持しておく
# レシーバの情報がここにはないことに注意
methods = {1 => :foo,
2 => :bar,
3 => :baz}
# キーを使って関連するメソッドを呼び出... -
Object
# send(name , *args) { . . . . } -> object (6163.0) -
オブジェクトのメソッド name を args を引数に して呼び出し、メソッドの実行結果を返します。
...クもそのまま引き渡します。
send が再定義された場合に備えて別名 __send__ も
用意されており、ライブラリではこちらを使うべきです。また
__send__ は再定義すべきではありません。
send, __send__ は、メソッドの呼び出し制限......lic_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
d......ef bar() "bar" end
def baz() "baz" end
end
# 任意のキーとメソッド(の名前)の関係をハッシュに保持しておく
# レシーバの情報がここにはないことに注意
methods = {1 => :foo,
2 => :bar,
3 => :baz}
# キーを使って関連するメソッドを呼び出... -
Symbol
# end _ with?(*suffixes) -> bool (6158.0) -
self の末尾が suffixes のいずれかであるとき true を返します。
...。
(self.to_s.end_with?と同じです。)
@param suffixes パターンを表す文字列 (のリスト)
@see Symbol#start_with?
@see String#end_with?
//emlist[][ruby]{
:hello.end_with?("ello") #=> true
# returns true if one of the +suffixes+ matches.
:hello.end_with?("heaven",......"ello") #=> true
:hello.end_with?("heaven", "paradise") #=> false
//}... -
MatchData
# byteend(n) -> Integer | nil (6157.0) -
n 番目の部分文字列終端のバイトオフセットを返します。
...バイトオフセットを返します。
@param n 部分文字列を指定する数値。
@param name 名前付きキャプチャを指定する文字列またはシンボル。
@raise IndexError 範囲外の n を指定した場合に発生します。
@raise IndexError 正規表現中で定義......発生します。
//emlist[例][ruby]{
/(c).*(いう).*(e.*)/ =~ 'abcあいうdef'
p $~ # => #<MatchData "cあいうdef" 1:"c" 2:"いう" 3:"ef">
p $~.byteend(0) # => 15
p $~.byteend(1) # => 3
p $~.byteend(2) # => 12
p $~.byteend(3) # => 15
p $~.byteend(4) # => index 4 out of matches (I......exError)
//}
//emlist[シンボルを指定する例][ruby]{
/(?<key>\S+):\s*(?<value>\S+)/ =~ "name: ruby"
$~ # => #<MatchData "name: ruby" key:"name" value:"ruby">
$~.byteend(:key) # => 4
$~.byteend(:value) # => 10
$~.byteend(:foo) # => undefined group name reference: foo (Ind... -
MatchData
# byteend(name) -> Integer | nil (6157.0) -
n 番目の部分文字列終端のバイトオフセットを返します。
...バイトオフセットを返します。
@param n 部分文字列を指定する数値。
@param name 名前付きキャプチャを指定する文字列またはシンボル。
@raise IndexError 範囲外の n を指定した場合に発生します。
@raise IndexError 正規表現中で定義......発生します。
//emlist[例][ruby]{
/(c).*(いう).*(e.*)/ =~ 'abcあいうdef'
p $~ # => #<MatchData "cあいうdef" 1:"c" 2:"いう" 3:"ef">
p $~.byteend(0) # => 15
p $~.byteend(1) # => 3
p $~.byteend(2) # => 12
p $~.byteend(3) # => 15
p $~.byteend(4) # => index 4 out of matches (I......exError)
//}
//emlist[シンボルを指定する例][ruby]{
/(?<key>\S+):\s*(?<value>\S+)/ =~ "name: ruby"
$~ # => #<MatchData "name: ruby" key:"name" value:"ruby">
$~.byteend(:key) # => 4
$~.byteend(:value) # => 10
$~.byteend(:foo) # => undefined group name reference: foo (Ind... -
String
# end _ with?(*strs) -> bool (6146.0) -
self の末尾が strs のいずれかであるとき true を返します。
...true を返します。
@param strs パターンを表す文字列 (のリスト)
//emlist[例][ruby]{
"string".end_with?("ing") # => true
"string".end_with?("str") # => false
"string".end_with?("str", "ing") # => true
//}
@see String#start_with?
@see String#delete_suffix,...