別のキーワード
ライブラリ
クラス
-
ARGF
. class (72) - Array (877)
- BasicObject (84)
- BigDecimal (132)
- Binding (12)
- CSV (36)
-
CSV
:: Row (36) -
CSV
:: Table (84) - Class (12)
- Complex (66)
- Data (15)
- Date (60)
- Dir (92)
- Enumerator (72)
- Exception (24)
- Fiber (30)
- File (16)
-
File
:: Stat (12) - Float (126)
- FrozenError (6)
-
Gem
:: Version (36) - Hash (562)
- IO (312)
- Integer (471)
-
JSON
:: State (24) - MatchData (48)
- Matrix (239)
-
Matrix
:: LUPDecomposition (12) - Method (115)
- Module (488)
- Mutex (2)
- Numeric (311)
- Object (302)
-
OpenSSL
:: BN (132) - OptionParser (240)
- Pathname (299)
-
Prime
:: PseudoPrimeGenerator (48) - Proc (14)
-
Psych
:: Stream (24) -
REXML
:: Attributes (12) -
REXML
:: Child (24) -
REXML
:: Element (36) -
Rake
:: FileList (12) - Random (36)
- Range (128)
- Rational (87)
-
RubyVM
:: AbstractSyntaxTree :: Node (14) -
RubyVM
:: InstructionSequence (84) - Set (240)
- String (1357)
- StringIO (100)
- StringScanner (72)
- Struct (40)
- Symbol (45)
- Thread (58)
-
Thread
:: Backtrace :: Location (60) -
Thread
:: ConditionVariable (24) -
Thread
:: Mutex (10) -
Thread
:: SizedQueue (10) - ThreadGroup (12)
- Time (48)
- TracePoint (72)
- UnboundMethod (48)
- Vector (36)
-
WIN32OLE
_ TYPE (12)
モジュール
- Comparable (27)
- Enumerable (335)
キーワード
- ! (12)
- != (12)
- !~ (12)
- % (50)
- & (12)
- * (36)
- ** (12)
- + (36)
- +@ (22)
- - (12)
- -@ (43)
-
/ (11) - < (46)
- << (110)
- <= (46)
- <=> (138)
- == (99)
- === (44)
- =~ (12)
- > (46)
- >= (46)
- >> (26)
- [] (108)
- []= (91)
-
_ dump (12) - abbrev (12)
- abs (12)
- abs2 (12)
-
absolute
_ path (24) - add (24)
- add? (12)
-
add
_ namespace (24) -
add
_ row (12) -
alias
_ method (8) - allbits? (8)
-
angle
_ with (12) - anybits? (8)
- append (8)
-
append
_ as _ bytes (1) -
append
_ features (12) - atime (12)
- autoload (12)
-
backtrace
_ locations (24) -
base
_ label (24) - basename (12)
- between? (12)
- bind (12)
-
bind
_ call (12) - binmode (24)
- binread (12)
-
bit
_ length (12) - broadcast (12)
- bsearch (24)
-
bsearch
_ index (20) -
by
_ col! (12) -
by
_ col _ or _ row! (12) -
by
_ row! (12) - byterindex (3)
- bytes (38)
- call (24)
- capitalize! (12)
- casecmp (12)
- casecmp? (9)
- ceil (36)
- ceildiv (3)
- center (12)
- chars (24)
- children (26)
- chomp (12)
- chomp! (12)
- chop! (12)
- chown (12)
- chr (36)
-
chunk
_ while (12) - clamp (15)
- class (12)
-
class
_ eval (24) -
class
_ exec (12) - clear (12)
-
clear
_ bit! (12) - clone (24)
- close (34)
- closed? (12)
- codepoints (24)
- coerce (72)
- collect! (50)
- column (24)
- combination (24)
- compact (13)
- compact! (9)
-
compare
_ by _ identity (12) - concat (54)
- configure (12)
- conj (12)
- conjugate (12)
- count (12)
- cover? (14)
- crypt (12)
- ctime (12)
- curry (22)
- deconstruct (3)
-
deconstruct
_ keys (9) - dedup (3)
- default (24)
-
default
_ event _ sources (12) -
define
_ singleton _ method (24) -
defined
_ class (12) - delete (36)
- delete! (12)
- delete? (12)
-
delete
_ if (96) -
delete
_ namespace (12) -
delete
_ prefix! (8) -
delete
_ suffix! (8) -
deprecate
_ constant (12) - difference (7)
- dig (30)
- digits (24)
- dirname (12)
- disable (24)
- disasm (12)
- disassemble (12)
- disjoint? (12)
- display (12)
- div (12)
- divmod (36)
- downcase! (12)
- downto (24)
- dup (24)
- each (276)
-
each
_ byte (72) -
each
_ char (48) -
each
_ child (38) -
each
_ codepoint (24) -
each
_ cons (8) -
each
_ entry (39) -
each
_ grapheme _ cluster (16) -
each
_ index (24) -
each
_ key (24) -
each
_ line (144) -
each
_ pair (24) -
each
_ slice (8) -
each
_ value (24) -
each
_ with _ index (72) - eigen (12)
- eigensystem (12)
- empty? (9)
- enable (24)
- encode (36)
- encode! (24)
-
end
_ with? (18) - entries (19)
-
enum
_ for (24) - eql? (27)
- equal? (36)
- eval (12)
- exception (24)
- extend (12)
-
extend
_ object (12) - extended (12)
- fdiv (36)
-
fetch
_ values (22) - fileno (11)
- fill (72)
- filter! (28)
- finite? (9)
- flatten (24)
- flatten! (24)
- floor (36)
- flush (12)
- fnmatch (12)
-
force
_ encoding (12) - freeze (24)
- gcd (12)
- gcdlcm (12)
- getbyte (12)
- getc (12)
-
grapheme
_ clusters (16) - gsub! (48)
- hash (24)
- hex (12)
- hstack (12)
- import (12)
- include (12)
- include? (12)
- included (12)
-
included
_ modules (12) - infinite? (9)
- inherited (12)
-
initialize
_ copy (12) - inject (36)
- insert (24)
- inspect (55)
-
instance
_ eval (24) -
instance
_ exec (12) -
instance
_ method (12) -
keep
_ if (48) - label (24)
- lcm (12)
- lines (38)
- ljust (12)
- localtime (24)
- lshift! (12)
- lup (12)
-
lup
_ decomposition (12) - magnitude (12)
- map! (50)
-
marshal
_ load (12) -
mask
_ bits! (12) - match (24)
- match? (18)
-
max
_ by (48) - merge (48)
- merge! (24)
- minor (24)
-
mod
_ add (12) -
mod
_ exp (12) -
mod
_ inverse (12) -
mod
_ mul (12) -
mod
_ sub (12) -
module
_ eval (24) -
module
_ exec (12) - modulo (24)
- name= (10)
- negative? (29)
- next (12)
- next! (12)
-
next
_ float (11) -
next
_ sibling= (12) -
next
_ year (12) - nobits? (8)
- nonzero? (12)
- offset (24)
- on (144)
-
on
_ head (12) -
on
_ tail (12) - ord (12)
- order! (24)
- overlap? (2)
- parse! (12)
-
parse
_ csv (12) - partition (12)
- path (32)
- permutation (24)
- permute! (12)
- polar (12)
- pos= (12)
- positive? (29)
- pow (24)
- pred (12)
- prepend (20)
-
prepend
_ features (12) - prepended (12)
- prerelease? (12)
-
pretty
_ print (12) -
prev
_ float (11) -
prev
_ year (12) -
previous
_ sibling= (12) -
prime
_ division (12) -
private
_ class _ method (24) -
private
_ constant (12) - product (24)
-
proper
_ subset? (12) -
proper
_ superset? (12) - public (48)
-
public
_ class _ method (24) -
public
_ constant (12) -
public
_ instance _ method (12) - push (24)
- putc (12)
- puts (12)
- quo (12)
- raise (18)
- rand (36)
- rationalize (12)
- realpath (24)
- receiver (6)
- rect (12)
- rectangular (12)
- reduce (36)
- rehash (12)
- reject (24)
- reject! (60)
-
relative
_ path _ from (12) - release (12)
- remainder (36)
-
remove
_ method (12) - reopen (36)
-
repeated
_ combination (24) -
repeated
_ permutation (24) - replace (36)
- reset (12)
- resume (12)
-
reverse
_ each (28) - rewind (24)
- rindex (12)
- rjust (12)
- rotate! (12)
- round (12)
- row (24)
- rpartition (12)
- rshift! (12)
- rstrip! (12)
- run (12)
- sample (48)
- scan (24)
- scrub (36)
- scrub! (36)
- seek (12)
- select! (48)
-
set
_ bit! (12) - shift (12)
- shuffle! (24)
- signal (12)
-
singleton
_ methods (12) - size (13)
- slice (72)
-
slice
_ when (12) - solve (12)
- sort (24)
- sort! (24)
-
sort
_ by (24) -
sort
_ by! (24) - split (26)
- squeeze! (12)
- start (24)
-
start
_ with? (18) - step (124)
- strip! (12)
- sub (24)
- sub! (36)
- subset? (12)
- subtract (12)
- succ (12)
- succ! (12)
- sum (24)
- summarize (24)
-
super
_ method (11) - superset? (12)
- swapcase! (12)
- synchronize (12)
- taint (9)
- tally (8)
- tap (8)
- terminate (12)
- then (14)
- times (24)
-
to
_ a (19) -
to
_ ary (12) -
to
_ bn (12) -
to
_ csv (12) -
to
_ enum (24) -
to
_ h (33) -
to
_ hash (12) -
to
_ path (8) -
to
_ proc (12) -
to
_ s (72) -
tr
_ s! (12) -
transform
_ keys! (20) -
transform
_ values! (18) - truncate (12)
- trust (9)
-
undef
_ method (12) - undump (8)
-
unicode
_ normalize (11) -
unicode
_ normalize! (11) -
unicode
_ normalized? (11) - union (7)
- uniq (24)
- unscan (12)
- unshift (12)
- untaint (9)
- untrust (9)
- upcase! (12)
- update (24)
- upto (36)
- using (12)
- vstack (12)
- wait (12)
-
wait
_ readable (12) - wakeup (12)
- with (3)
-
with
_ index (24) -
yield
_ self (16) - zip (48)
- | (12)
検索結果
先頭5件
-
String
# %(args) -> String (433.0) -
printf と同じ規則に従って args をフォーマットします。
...あれば Kernel.#sprintf(self, *args) と同じです。
それ以外の場合は Kernel.#sprintf(self, args) と同じです。
@param args フォーマットする値、もしくはその配列
@return フォーマットされた文字列
//emlist[例][ruby]{
p "i = %d" % 10 #......= 0xa"
p "i = %#o" % 10 # => "i = 012"
p "%d" % 10 # => "10"
p "%d,%o" % [10, 10] # => "10,12"
//}
=== sprintf フォーマット
Ruby の sprintf フォーマットは基本的に C 言語の sprintf(3)
のものと同じです。ただし、short や long などの C 特有の......, %B)が存在すること、sprintf のすべての方言をサ
ポートしていないこと(%': 3桁区切り)などの違いがあります。
Ruby には整数の大きさに上限がないので、%b, %B, %o, %x, %X
に負の数を与えると (左側に無限に1が続くとみなせるの... -
Hash
# merge!(*others) {|key , self _ val , other _ val| . . . } -> self (319.0) -
selfとothersのハッシュの内容を順番にマージ(統合)します。
...
selfとothersのハッシュの内容を順番にマージ(統合)します。
デフォルト値はselfの設定のままです。
self と others に同じキーがあった場合はブロック付きか否かで
判定方法が違います。ブロック付きのときはブロックを呼び......to_hashを使って暗黙の変換を試みます。
@param others マージ用のハッシュまたはメソッド to_hash でハッシュに変換できるオブジェクトです。
@return マージ後のselfを返します。
//emlist[][ruby]{
h1 = { "a" => 100, "b" => 200 }
h1.merge!......#=> {"a"=>100, "b"=>200}
//}
//emlist[][ruby]{
h1 = { "a" => 100, "b" => 200 }
h2 = { "b" => 246, "c" => 300 }
h1.merge!(h2) #=> {"a"=>100, "b"=>246, "c"=>300}
h1 #=> {"a"=>100, "b"=>246, "c"=>300}
//}
//emlist[][ruby]{
h1 = { "a" => 100, "b" => 200 }
h2 = { "b" => 2... -
Hash
# update(*others) {|key , self _ val , other _ val| . . . } -> self (319.0) -
selfとothersのハッシュの内容を順番にマージ(統合)します。
...
selfとothersのハッシュの内容を順番にマージ(統合)します。
デフォルト値はselfの設定のままです。
self と others に同じキーがあった場合はブロック付きか否かで
判定方法が違います。ブロック付きのときはブロックを呼び......to_hashを使って暗黙の変換を試みます。
@param others マージ用のハッシュまたはメソッド to_hash でハッシュに変換できるオブジェクトです。
@return マージ後のselfを返します。
//emlist[][ruby]{
h1 = { "a" => 100, "b" => 200 }
h1.merge!......#=> {"a"=>100, "b"=>200}
//}
//emlist[][ruby]{
h1 = { "a" => 100, "b" => 200 }
h2 = { "b" => 246, "c" => 300 }
h1.merge!(h2) #=> {"a"=>100, "b"=>246, "c"=>300}
h1 #=> {"a"=>100, "b"=>246, "c"=>300}
//}
//emlist[][ruby]{
h1 = { "a" => 100, "b" => 200 }
h2 = { "b" => 2... -
Hash
# merge!(other) {|key , self _ val , other _ val| . . . } -> self (283.0) -
selfとotherのハッシュの内容をマージ(統合)します。
...
selfとotherのハッシュの内容をマージ(統合)します。
デフォルト値はselfの設定のままです。
self と other に同じキーがあった場合はブロック付きか否かで
判定方法が違います。ブロック付きのときはブロックを呼び出して......to_hashを使って暗黙の変換を試みます。
@param other マージ用のハッシュまたはメソッド to_hash でハッシュに変換できるオブジェクトです。
@return マージ後のselfを返します。
//emlist[][ruby]{
h1 = { "a" => 100, "b" => 200 }
h2 = { "b" => 254,......"c" => 300 }
h1.merge!(h2) # => {"a"=>100, "b"=>254, "c"=>300}
h1 # => {"a"=>100, "b"=>254, "c"=>300}
//}
//emlist[][ruby]{
foo = {1 => 'a', 2 => 'b', 3 => 'c'}
bar = {2 => 'B', 3 => 'C', 4 => 'D'}
p foo.update(bar) #=> {1=>"a", 2=>"B", 3=>"C", 4=>"D"}
p foo #=> {1=>"a", 2=>"B", 3... -
Hash
# update(other) {|key , self _ val , other _ val| . . . } -> self (283.0) -
selfとotherのハッシュの内容をマージ(統合)します。
...
selfとotherのハッシュの内容をマージ(統合)します。
デフォルト値はselfの設定のままです。
self と other に同じキーがあった場合はブロック付きか否かで
判定方法が違います。ブロック付きのときはブロックを呼び出して......to_hashを使って暗黙の変換を試みます。
@param other マージ用のハッシュまたはメソッド to_hash でハッシュに変換できるオブジェクトです。
@return マージ後のselfを返します。
//emlist[][ruby]{
h1 = { "a" => 100, "b" => 200 }
h2 = { "b" => 254,......"c" => 300 }
h1.merge!(h2) # => {"a"=>100, "b"=>254, "c"=>300}
h1 # => {"a"=>100, "b"=>254, "c"=>300}
//}
//emlist[][ruby]{
foo = {1 => 'a', 2 => 'b', 3 => 'c'}
bar = {2 => 'B', 3 => 'C', 4 => 'D'}
p foo.update(bar) #=> {1=>"a", 2=>"B", 3=>"C", 4=>"D"}
p foo #=> {1=>"a", 2=>"B", 3... -
Array
# permutation(n = self . length) { |p| block } -> self (252.0) -
サイズ n の順列をすべて生成し,それを引数としてブロックを実行します。
...rator オブジェクトを返します。
@param n 生成する配列のサイズを整数で指定します。
整数以外のオブジェクトを指定した場合は to_int メソッドによる暗
黙の型変換を試みます。
@raise TypeError 引数に整数以外の(......暗黙の型変換が行えない)オブジェクトを
指定した場合に発生します。
//emlist[例][ruby]{
a = [1, 2, 3]
a.permutation.to_a #=> [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]
a.permutation(1).to_a #=> [[1],[2],[3]]
a.permutation(2).to_a #=> [[1,2]......した配列の各要素を引数としてブロックを実
行して self を返します。
//emlist[例][ruby]{
a = [1, 2, 3]
result = []
a.permutation(2) {|e| result << e} # => [1,2,3]
result # => [[1,2],[1,3],[2,1],[2,3],[3,1],[3,2]]
//}
@see Array#combination, Array#repeated_permutation... -
OptionParser
# summarize(to = [] , width = self . summary _ width , max = width - 1 , indent= self . summary _ indent) -> () (241.0) -
サマリを指定された to へと加えていきます。
...ません。
@param to サマリを出力するオブジェクトを指定します。to には << メソッドが定義されいる必要があります。
@param width サマリの幅を整数で指定します。
@param max サマリの最大幅を整数で指定します。
@param indent サ......マリのインデントを文字列で指定します。
//emlist[例][ruby]{
require "optparse"
opts = OptionParser.new do |opts|
opts.on_head("-i", "--init")
opts.on("-u", "--update")
opts.on_tail("-h", "--help")
end
opts.summarize
# => [" -i, --init\n", " -u, --update\n", " -h,... -
OptionParser
# summarize(to = [] , width = self . summary _ width , max = width - 1 , indent= self . summary _ indent) {|line| . . . } -> () (241.0) -
サマリを指定された to へと加えていきます。
...ません。
@param to サマリを出力するオブジェクトを指定します。to には << メソッドが定義されいる必要があります。
@param width サマリの幅を整数で指定します。
@param max サマリの最大幅を整数で指定します。
@param indent サ......マリのインデントを文字列で指定します。
//emlist[例][ruby]{
require "optparse"
opts = OptionParser.new do |opts|
opts.on_head("-i", "--init")
opts.on("-u", "--update")
opts.on_tail("-h", "--help")
end
opts.summarize
# => [" -i, --init\n", " -u, --update\n", " -h,... -
String
# split(sep = $ ; , limit = 0) {|s| . . . } -> self (240.0) -
第 1 引数 sep で指定されたセパレータによって文字列を limit 個まで分割し、 結果を文字列の配列で返します。 ブロックを指定すると、配列を返す代わりに分割した文字列で ブロックを呼び出します。
...分割個数の制限はなし
@param sep 文字列を分割するときのセパレータのパターン
@param limit 分割する最大個数
@return ブロックを渡した場合は self、ブロックなしの場合は配列
//emlist[例][ruby]{
p " a \t b \n c".split(/\s+......][ruby]{
p '1-10,20'.split(/([-,])/) # => ["1", "-", "10", ",", "20"]
//}
//emlist[正規表現が空文字列にマッチする場合は 1 文字に分割][ruby]{
p 'hi there'.split(/\s*/).join(':') # => "h:i:t:h:e:r:e"
//}
//emlist[文字列全体を 1 文字ずつに分割する例][ruby]{
p......字列は取り除かれる][ruby]{
p "a,b,c,,,".split(/,/, 0) # => ["a", "b", "c"]
//}
//emlist[limit 省略時は 0 と同じ (最もよく使われるパターン)][ruby]{
p "a,b,c,,,".split(/,/) # => ["a", "b", "c"]
//}
//emlist[正の limit 使用例][ruby]{
p "a,b,c,d,e".split(/,/, 1)... -
Hash
# merge!(*others) -> self (219.0) -
selfとothersのハッシュの内容を順番にマージ(統合)します。
...
selfとothersのハッシュの内容を順番にマージ(統合)します。
デフォルト値はselfの設定のままです。
self と others に同じキーがあった場合はブロック付きか否かで
判定方法が違います。ブロック付きのときはブロックを呼び......to_hashを使って暗黙の変換を試みます。
@param others マージ用のハッシュまたはメソッド to_hash でハッシュに変換できるオブジェクトです。
@return マージ後のselfを返します。
//emlist[][ruby]{
h1 = { "a" => 100, "b" => 200 }
h1.merge!......#=> {"a"=>100, "b"=>200}
//}
//emlist[][ruby]{
h1 = { "a" => 100, "b" => 200 }
h2 = { "b" => 246, "c" => 300 }
h1.merge!(h2) #=> {"a"=>100, "b"=>246, "c"=>300}
h1 #=> {"a"=>100, "b"=>246, "c"=>300}
//}
//emlist[][ruby]{
h1 = { "a" => 100, "b" => 200 }
h2 = { "b" => 2... -
Hash
# update(*others) -> self (219.0) -
selfとothersのハッシュの内容を順番にマージ(統合)します。
...
selfとothersのハッシュの内容を順番にマージ(統合)します。
デフォルト値はselfの設定のままです。
self と others に同じキーがあった場合はブロック付きか否かで
判定方法が違います。ブロック付きのときはブロックを呼び......to_hashを使って暗黙の変換を試みます。
@param others マージ用のハッシュまたはメソッド to_hash でハッシュに変換できるオブジェクトです。
@return マージ後のselfを返します。
//emlist[][ruby]{
h1 = { "a" => 100, "b" => 200 }
h1.merge!......#=> {"a"=>100, "b"=>200}
//}
//emlist[][ruby]{
h1 = { "a" => 100, "b" => 200 }
h2 = { "b" => 246, "c" => 300 }
h1.merge!(h2) #=> {"a"=>100, "b"=>246, "c"=>300}
h1 #=> {"a"=>100, "b"=>246, "c"=>300}
//}
//emlist[][ruby]{
h1 = { "a" => 100, "b" => 200 }
h2 = { "b" => 2... -
OptionParser
# on(long , pat = / . * / , desc = "") {|v| . . . } -> self (206.0) -
オプションを取り扱うためのブロックを自身に登録します。 ブロックはコマンドラインのパース時に、オプションが指定されていれば呼ばれます。
...-zA-Z0-9_]+/){|name| ...}
# ruby command --username=ruby_user
# ruby command --username=ruby.user #=> Error
@param short ショートオプションを表す文字列を指定します。
@param long ロングオプションを表す文字列を指定します。
@param pat オプションの......引数に許すパターンを表す正規表現で指定します。
@param desc オプションの説明を文字列で与えます。サマリに表示されます。... -
OptionParser
# on(short , long , pat = / . * / , desc = "") {|v| . . . } -> self (206.0) -
オプションを取り扱うためのブロックを自身に登録します。 ブロックはコマンドラインのパース時に、オプションが指定されていれば呼ばれます。
...-zA-Z0-9_]+/){|name| ...}
# ruby command --username=ruby_user
# ruby command --username=ruby.user #=> Error
@param short ショートオプションを表す文字列を指定します。
@param long ロングオプションを表す文字列を指定します。
@param pat オプションの......引数に許すパターンを表す正規表現で指定します。
@param desc オプションの説明を文字列で与えます。サマリに表示されます。...