別のキーワード
ライブラリ
- ビルトイン (1334)
- date (4)
-
fiddle
/ import (36) - json (24)
- matrix (24)
-
net
/ http (156) - optparse (24)
- pathname (48)
- prime (72)
- rake (192)
-
rake
/ packagetask (12) -
rexml
/ document (24) -
rubygems
/ specification (36) - strscan (24)
- tsort (33)
クラス
- Array (93)
- Class (12)
- Data (6)
- Date (2)
- DateTime (2)
- Dir (24)
-
Encoding
:: Converter (48) - Enumerator (120)
-
Enumerator
:: Lazy (48) -
Enumerator
:: Yielder (30) - Exception (12)
- File (24)
-
File
:: Stat (72) -
Gem
:: Specification (36) - IO (48)
-
JSON
:: State (12) - MatchData (104)
- Matrix (24)
- Method (12)
- Module (252)
-
Net
:: HTTP (156) - Numeric (81)
- Object (72)
- OptionParser (24)
- Pathname (48)
- Prime (24)
-
Prime
:: PseudoPrimeGenerator (48) - Proc (6)
-
REXML
:: Attributes (24) -
Rake
:: Application (84) -
Rake
:: FileList (48) -
Rake
:: FileTask (12) -
Rake
:: InvocationChain (36) -
Rake
:: PackageTask (12) - Random (36)
- Range (6)
- Regexp (24)
-
RubyVM
:: InstructionSequence (24) - String (36)
- StringScanner (24)
-
Thread
:: Backtrace :: Location (48) - TracePoint (12)
モジュール
- Enumerable (84)
-
Fiddle
:: Importer (36) -
JSON
:: Generator :: GeneratorMethods :: Object (12) -
Rake
:: TaskManager (12) - TSort (33)
キーワード
- << (12)
- === (6)
- [] (84)
-
absolute
_ path (24) - accept (12)
-
add
_ dependency (12) -
add
_ development _ dependency (12) -
add
_ runtime _ dependency (12) - allocate (12)
- append (12)
-
append
_ features (12) - ascend (24)
- attr (36)
-
attr
_ accessor (12) -
attr
_ reader (12) -
attr
_ writer (12) - autoload (12)
-
backtrace
_ locations (12) -
base
_ label (12) - begin (12)
- bind (12)
- blockdev? (12)
- byteend (2)
- byteoffset (6)
- chardev? (12)
-
check
_ circular? (12) - chunk (12)
-
const
_ source _ location (12) -
create
_ rule (12) - deconstruct (3)
-
deconstruct
_ keys (7) - descend (24)
- each (96)
-
each
_ attribute (12) -
each
_ byte (24) -
each
_ codepoint (12) -
each
_ entry (12) -
each
_ index (12) -
each
_ line (12) -
each
_ strongly _ connected _ component (11) -
each
_ strongly _ connected _ component _ from (11) -
each
_ with _ index (60) - egrep (12)
-
enum
_ for (48) - fdatasync (12)
- feed (12)
- get (24)
- get2 (24)
- gsub! (12)
- inspect (12)
- lazy (12)
- lstat (12)
- match (24)
- match? (12)
-
matched
_ size (12) -
max
_ by (24) - member? (12)
- name (12)
- next (12)
-
next
_ values (12) - offset (24)
-
original
_ dir (12) - pack (21)
-
package
_ dir _ path (12) - path (36)
- pathmap (12)
-
peek
_ values (12) - post (24)
- post2 (24)
-
prepend
_ features (12) -
primitive
_ convert (48) - private (48)
-
private
_ class _ method (24) -
private
_ constant (12) -
private
_ instance _ methods (12) -
private
_ method _ defined? (12) - rakefile (12)
- rand (36)
-
remove
_ const (12) -
request
_ get (24) -
request
_ post (24) -
respond
_ to _ missing? (12) -
ruby2
_ keywords (18) -
send
_ request (12) - separator (12)
- setgid? (12)
- setuid? (12)
- socket? (12)
-
sort
_ by (12) -
source
_ location (12) - stat (12)
- step (81)
- sticky? (12)
- struct (12)
- sub! (12)
-
to
_ enum (48) -
to
_ json (12) -
to
_ path (12) -
to
_ proc (6) -
to
_ regexp (12) -
to
_ s (24) -
top
_ level (12) -
top
_ level _ tasks (12) - truncate (12)
-
tsort
_ each (11) -
tty
_ output= (12) - union (12)
- unpack (12)
-
with
_ index (24) -
with
_ object (24) - yield (12)
検索結果
先頭5件
-
MatchData
# end(n) -> Integer | nil (24150.0) -
n 番目の部分文字列終端のオフセットを返します。
...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': index 4 out of matches (IndexError)
//}
@see MatchData#begin... -
Array
# at(nth) -> object | nil (15122.0) -
nth 番目の要素を返します。nth 番目の要素が存在しない時には nil を返します。
...みます。
@raise TypeError 引数に整数以外の(暗黙の型変換が行えない)オブジェクトを
指定した場合に発生します。
//emlist[例][ruby]{
a = [ "a", "b", "c", "d", "e" ]
a[0] #=> "a"
a[1] #=> "b"
a[-1] #=> "e"
a[-2] #=> "d"
a[10] #=> nil
//}... -
Module
# ruby2 _ keywords(method _ name , . . . ) -> nil (12281.0) -
For the given method names, marks the method as passing keywords through a normal argument splat. This should only be called on methods that accept an argument splat (`*args`) but not explicit keywords or a keyword splat. It marks the method such that if the method is called with keyword arguments, the final hash argument is marked with a special flag such that if it is the final element of a normal argument splat to another method call, and that method call does not include explicit keywords or a keyword splat, the final element is interpreted as keywords. In other words, keywords will be passed through the method to other methods.
...al argument splat. This should only be called on methods that
accept an argument splat (`*args`) but not explicit keywords or a
keyword splat. It marks the method such that if the method is called
with keyword arguments, the final hash argument is marked with a special
flag such that if it is the......argument splat to
another method call, and that method call does not include explicit
keywords or a keyword splat, the final element is interpreted as
keywords. In other words, keywords will be passed through the method to
other methods.
This should only be used for methods that delegate keywords t......ackwards compatibility with Ruby versions before
2.7.
This method will probably be removed at some point, as it exists only
for backwards compatibility. As it does not exist in Ruby versions
before 2.7, check that the module responds to this method before calling
it. Also, be aware that if this met... -
Proc
# ruby2 _ keywords -> proc (12281.0) -
Marks the proc as passing keywords through a normal argument splat. This should only be called on procs that accept an argument splat (`*args`) but not explicit keywords or a keyword splat. It marks the proc such that if the proc is called with keyword arguments, the final hash argument is marked with a special flag such that if it is the final element of a normal argument splat to another method call, and that method call does not include explicit keywords or a keyword splat, the final element is interpreted as keywords. In other words, keywords will be passed through the proc to other methods.
...ormal argument splat. This
should only be called on procs that accept an argument splat (`*args`)
but not explicit keywords or a keyword splat. It marks the proc such
that if the proc is called with keyword arguments, the final hash
argument is marked with a special flag such that if it is the fina......l argument splat to another method call, and that
method call does not include explicit keywords or a keyword splat, the
final element is interpreted as keywords. In other words, keywords will
be passed through the proc to other methods.
This should only be used for procs that delegate keywords to......backwards compatibility with Ruby versions before
2.7.
This method will probably be removed at some point, as it exists only
for backwards compatibility. As it does not exist in Ruby versions
before 2.7, check that the proc responds to this method before calling
it. Also, be aware that if this meth... -
Module
# prepend _ features(mod) -> self (12249.0) -
Module#prepend から呼び出されるメソッドで、 prepend の処理の実体です。このメソッド自体は mod で指定した モジュール/クラスの継承チェインの先頭に self を追加します。
...Module#prepend から呼び出されるメソッドで、
prepend の処理の実体です。このメソッド自体は mod で指定した
モジュール/クラスの継承チェインの先頭に self を追加します。
このメソッドを上書きすることで、prepend の処理を変......m 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
Recorde......r::RECORDS # => [A, C]
//}
@see Module#prepend, Module#prepended... -
Module
# append _ features(module _ or _ class) -> self (12237.0) -
モジュール(あるいはクラス)に self の機能を追加します。
... Ruby で書くと以下のように定義できます。
//emlist[例][ruby]{
def include(*modules)
modules.reverse_each do |mod|
# append_features や included はプライベートメソッドなので
# 直接 mod.append_features(self) などとは書けない
mod.__send__(:append......_features, self)
mod.__send__(:included, self)
end
end
//}
@see Module#included... -
MatchData
# byteend(n) -> Integer | nil (12161.0) -
n 番目の部分文字列終端のバイトオフセットを返します。
...。
//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 (IndexError)
//}......//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 (IndexError)
//}... -
MatchData
# byteend(name) -> Integer | nil (12161.0) -
n 番目の部分文字列終端のバイトオフセットを返します。
...。
//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 (IndexError)
//}......//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 (IndexError)
//}... -
RubyVM
:: InstructionSequence # absolute _ path -> String | nil (12107.0) -
self が表す命令シーケンスの絶対パスを返します。
...= RubyVM::InstructionSequence.compile('num = 1 + 2')
# => <RubyVM::InstructionSequence:<compiled>@<compiled>>
iseq.absolute_path
# => nil
例2: RubyVM::InstructionSequence.compile_file を使用した場合
# /tmp/method.rb
def hello
puts "hello, world"
end
# irb
> iseq = Ruby......VM::InstructionSequence.compile_file('/tmp/method.rb')
> iseq.absolute_path # => "/tmp/method.rb"
@see RubyVM::InstructionSequence#path... -
RubyVM
:: InstructionSequence # path -> String (12107.0) -
self が表す命令シーケンスの相対パスを返します。
...= RubyVM::InstructionSequence.compile('num = 1 + 2')
# => <RubyVM::InstructionSequence:<compiled>@<compiled>>
iseq.path
# => "<compiled>"
例2: RubyVM::InstructionSequence.compile_file を使用した場合
# /tmp/method.rb
def hello
puts "hello, world"
end
# irb
> iseq = Ruby......VM::InstructionSequence.compile_file('method.rb')
> iseq.path # => "method.rb"
@see RubyVM::InstructionSequence#absolute_path... -
REXML
:: Attributes # each _ attribute {|attribute| . . . } -> () (9219.0) -
各属性に対しブロックを呼び出します。
...個々の属性は REXML::Attribute オブジェクトで渡されます。
//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new(<<EOS)
<root xmlns:foo="http://example.org/foo"
xmlns:bar="http://example.org/bar">
<a foo:att='1' bar:att='2' att='<'/>
</root>
EOS
a = doc.......get_elements("/root/a").first
a.attributes.each_attribute do |attr|
p [attr.namespace, attr.name, attr.value]
end
# => ["http://example.org/foo", "att", "1"]
# => ["http://example.org/bar", "att", "2"]
# => ["", "att", "<"]
//}...