別のキーワード
ライブラリ
- ビルトイン (3871)
- abbrev (12)
- bigdecimal (60)
-
cgi
/ core (12) - csv (132)
- digest (60)
- erb (24)
-
irb
/ cmd / help (12) - json (156)
-
json
/ add / bigdecimal (12) -
json
/ add / complex (12) -
json
/ add / date (12) -
json
/ add / date _ time (12) -
json
/ add / exception (12) -
json
/ add / range (12) -
json
/ add / rational (12) -
json
/ add / regexp (12) -
json
/ add / struct (12) -
json
/ add / time (12) - logger (12)
- mkmf (12)
-
net
/ http (132) - openssl (12)
- optparse (396)
- pathname (36)
- psych (12)
- rake (24)
-
rexml
/ document (132) -
rubygems
/ installer (12) -
rubygems
/ requirement (12) - socket (12)
- stringio (304)
- strscan (312)
- uri (36)
- win32ole (36)
クラス
-
ARGF
. class (84) - Array (81)
- BasicObject (12)
- BigDecimal (72)
- CGI (12)
- CSV (72)
-
CSV
:: Table (36) - Complex (12)
- Date (12)
- DateTime (12)
-
Digest
:: Base (60) - Dir (19)
- ERB (24)
-
Encoding
:: Converter (84) -
Encoding
:: InvalidByteSequenceError (12) - Enumerator (24)
- Exception (44)
- File (16)
- Float (24)
-
Gem
:: Installer (12) -
Gem
:: Requirement (12) - IO (64)
-
IRB
:: ExtendCommand :: Help (12) - Integer (60)
-
JSON
:: State (48) - Logger (12)
- MatchData (110)
- Method (36)
- Module (600)
-
Net
:: HTTPGenericRequest (12) -
Net
:: HTTPResponse (24) - NilClass (7)
- Object (237)
-
OpenSSL
:: BN (12) - OptionParser (348)
- Pathname (36)
- Proc (12)
-
Psych
:: ScalarScanner (12) -
REXML
:: Attribute (12) -
REXML
:: Attributes (12) -
REXML
:: CData (24) -
REXML
:: DocType (24) -
REXML
:: Element (24) -
REXML
:: Entity (12) -
REXML
:: Text (24) -
Rake
:: FileList (24) - Random (12)
- Range (90)
- Rational (36)
- Regexp (60)
-
RubyVM
:: AbstractSyntaxTree :: Node (7) -
RubyVM
:: InstructionSequence (94) - Socket (12)
- String (1874)
- StringIO (304)
- StringScanner (312)
- Struct (36)
- Symbol (59)
- Thread (10)
-
Thread
:: Backtrace :: Location (72) - Time (24)
- TracePoint (19)
-
URI
:: MailTo (36) - UnboundMethod (60)
-
WIN32OLE
_ TYPE (12) -
WIN32OLE
_ TYPELIB (12) -
WIN32OLE
_ VARIANT (12)
モジュール
-
JSON
:: Generator :: GeneratorMethods :: Array (12) -
JSON
:: Generator :: GeneratorMethods :: FalseClass (12) -
JSON
:: Generator :: GeneratorMethods :: Float (12) -
JSON
:: Generator :: GeneratorMethods :: Hash (12) -
JSON
:: Generator :: GeneratorMethods :: Integer (12) -
JSON
:: Generator :: GeneratorMethods :: NilClass (12) -
JSON
:: Generator :: GeneratorMethods :: Object (12) -
JSON
:: Generator :: GeneratorMethods :: String (12) -
JSON
:: Generator :: GeneratorMethods :: TrueClass (12) - Kernel (12)
-
Net
:: HTTPHeader (96) -
OptionParser
:: Arguable (48)
キーワード
- % (26)
- * (36)
- + (12)
- +@ (10)
- -@ (10)
- << (24)
- <=> (24)
- == (24)
- === (48)
- =~ (40)
- [] (204)
- []= (96)
-
_ _ id _ _ (12) -
_ dump (24) - abbrev (12)
-
absolute
_ path (24) -
add
_ element (12) -
alias
_ method (12) -
arg
_ config (12) - attr (36)
-
attr
_ accessor (12) -
attr
_ reader (12) -
attr
_ writer (12) -
attribute
_ of (12) - autoload (12)
- autoload? (12)
- backtrace (12)
-
base
_ label (24) -
basic
_ auth (12) - binread (12)
- body (12)
- byteindex (3)
- byterindex (3)
- bytes (50)
- bytesize (12)
- byteslice (36)
- capitalize (12)
- capitalize! (12)
- captures (12)
- casecmp (24)
- casecmp? (18)
- center (12)
- charpos (12)
- chars (24)
- check (12)
-
check
_ until (12) - children (7)
- chomp (12)
- chomp! (12)
- chop (12)
- chop! (12)
- chr (36)
- class (12)
-
class
_ variable _ defined? (12) -
class
_ variable _ get (12) -
class
_ variable _ set (12) - clear (12)
- clone (12)
- codepoints (24)
- coerce (12)
-
col
_ sep (12) - concat (33)
- connect (12)
-
const
_ defined? (12) -
const
_ get (12) -
const
_ set (12) -
const
_ source _ location (12) - convert (12)
- count (12)
- cover? (19)
- crypt (12)
-
datetime
_ format (12) - deconstruct (2)
- dedup (3)
-
default
_ argv (12) -
define
_ method (24) -
define
_ singleton _ method (24) - delete (24)
- delete! (12)
-
delete
_ prefix (8) -
delete
_ prefix! (8) -
delete
_ suffix (8) -
delete
_ suffix! (8) -
deprecate
_ constant (12) - digest (12)
- digest! (12)
- disasm (12)
- disassemble (12)
- downcase (12)
- downcase! (12)
- dump (8)
- dup (12)
- each (24)
-
each
_ byte (48) -
each
_ char (24) -
each
_ codepoint (24) -
each
_ grapheme _ cluster (16) -
each
_ line (48) - encode (36)
- encode! (24)
- encoding (12)
-
end
_ with? (18) - entity (12)
- environment (12)
- eql? (24)
-
error
_ bytes (12) -
eval
_ script (7) - execute (12)
- exist? (12)
- ext (12)
- fetch (36)
- finish (12)
-
force
_ encoding (12) -
formatted
_ program _ filename (12) - freeze (12)
-
get
_ fields (12) - getbyte (24)
- getc (24)
- gets (60)
-
grapheme
_ clusters (16) - gsub (48)
- gsub! (48)
- hash (24)
- header (12)
- headers (12)
- helpfile (12)
- hex (12)
- hexdigest (12)
- hexdigest! (12)
- include? (12)
- indent= (12)
- index (12)
-
inplace
_ mode (12) - insert (12)
-
insert
_ output (12) - inspect (163)
-
instance
_ method (12) - join (12)
- label (24)
- length (12)
- lines (38)
- ljust (12)
- lstrip (12)
- match (24)
- match? (30)
- method (12)
-
method
_ defined? (12) -
module
_ function (36) - name (17)
- name= (10)
- namespace (12)
- next! (12)
-
object
_ nl= (12) - oct (12)
- on (144)
- ord (24)
- order (48)
- order! (48)
- pack (21)
- parse (24)
- parse! (24)
-
parse
_ csv (12) - partition (12)
- path (56)
- pathmap (12)
- peek (12)
- peep (12)
- permute (24)
- permute! (24)
- pointer (12)
- pointer= (12)
- pos (12)
- pos= (24)
-
post
_ match (12) -
pre
_ match (12) - pread (8)
- prepend (21)
-
pretty
_ print (12) - print (24)
- printf (12)
- private (48)
-
private
_ class _ method (24) -
private
_ constant (12) -
private
_ method _ defined? (12) -
program
_ name (12) -
protected
_ method _ defined? (12) -
proxy
_ basic _ auth (12) - public (48)
-
public
_ class _ method (24) -
public
_ constant (12) -
public
_ instance _ method (12) -
public
_ method (12) -
public
_ method _ defined? (12) - putback (24)
- puts (12)
- pwrite (8)
-
quote
_ char (12) - read (24)
-
read
_ body (24) - readbyte (12)
- readchar (24)
- readline (24)
- readlines (48)
-
remove
_ class _ variable (12) -
remove
_ const (12) -
remove
_ method (12) - reopen (24)
- replacement (12)
- replacement= (12)
- reset (12)
- result (12)
- rindex (12)
- rjust (12)
-
row
_ sep (12) - rpartition (12)
- rstrip (12)
- rstrip! (12)
- scan (36)
-
scan
_ full (12) -
scan
_ until (12) - scrub (36)
- scrub! (36)
-
search
_ full (12) -
set
_ backtrace (12) - setbyte (12)
- shift (12)
-
singleton
_ class (12) -
singleton
_ method (12) - size (12)
- skip (12)
-
skip
_ until (12) - slice (72)
-
source
_ location (36) - space= (12)
-
space
_ before= (12) - split (31)
- squeeze (12)
- squeeze! (12)
- src (12)
-
start
_ with? (18) - step (21)
- strftime (12)
- string= (12)
- strip (12)
- strip! (12)
- sub (60)
- sub! (36)
- succ! (12)
- sum (12)
-
summary
_ indent (12) - swapcase (12)
- swapcase! (12)
- syswrite (12)
- tainted? (6)
- terminate (12)
- text (12)
- then (14)
-
to
_ a (12) -
to
_ binary (10) -
to
_ c (12) -
to
_ csv (12) -
to
_ f (12) -
to
_ i (12) -
to
_ json (228) -
to
_ mailtext (12) -
to
_ path (8) -
to
_ r (12) -
to
_ rfc822text (12) -
to
_ s (204) -
to
_ str (12) - tokenize (12)
- tr (12)
-
tr
_ s (12) -
tr
_ s! (12) - truncate (12)
-
undef
_ method (12) - undump (8)
- ungetc (12)
-
unicode
_ normalize (11) -
unicode
_ normalize! (11) -
unicode
_ normalized? (11) - unpack (12)
- unpack1 (9)
- unscan (12)
- upcase (12)
- upcase! (12)
- upto (12)
- value (36)
-
values
_ at (12) -
with
_ object (24) - write (12)
-
yield
_ self (16)
検索結果
先頭5件
-
String
# -@ -> String | self (15227.0) -
self が freeze されている文字列の場合、self を返します。 freeze されていない場合は元の文字列の freeze された (できる限り既存の) 複製を返します。
...freeze されていない場合は元の文字列の freeze された (できる限り既存の) 複製を返します。
//emlist[例][ruby]{
# frozen_string_literal: false
original_text = "text"
frozen_text = -original_text
frozen_text.frozen? # => true
original_text == frozen_t......ext # => true
original_text.equal?(frozen_text) # => false
original_text = "text".freeze
frozen_text = -original_text
frozen_text.frozen? # => true
original_text == frozen_text # => true
original_text.equal?(frozen_text) # => true
//}
@see String#+@... -
String
# +@ -> String | self (15226.0) -
self が freeze されている文字列の場合、元の文字列の複製を返します。 freeze されていない場合は self を返します。
...文字列の場合、元の文字列の複製を返します。
freeze されていない場合は self を返します。
//emlist[例][ruby]{
# frozen_string_literal: false
original_text = "text"
unfrozen_text = +original_text
unfrozen_text.frozen? # => false
original_text == unf......_text # => true
original_text.equal?(unfrozen_text) # => true
original_text = "text".freeze
unfrozen_text = +original_text
unfrozen_text.frozen? # => false
original_text == unfrozen_text # => true
original_text.equal?(unfrozen_text) # => false
//}
@see String#-@... -
String
# -@ -> String | self (15226.0) -
self が freeze されている文字列の場合、self を返します。 freeze されていない場合は元の文字列の freeze された (できる限り既存の) 複製を返します。
...freeze されていない場合は元の文字列の freeze された (できる限り既存の) 複製を返します。
//emlist[例][ruby]{
# frozen_string_literal: false
original_text = "text"
frozen_text = -original_text
frozen_text.frozen? # => true
original_text == frozen_t......ext # => true
original_text.equal?(frozen_text) # => false
original_text = "text".freeze
frozen_text = -original_text
frozen_text.frozen? # => true
original_text == frozen_text # => true
original_text.equal?(frozen_text) # => true
//}
@see String#+@... -
String
# dedup -> String | self (12127.0) -
self が freeze されている文字列の場合、self を返します。 freeze されていない場合は元の文字列の freeze された (できる限り既存の) 複製を返します。
...freeze されていない場合は元の文字列の freeze された (できる限り既存の) 複製を返します。
//emlist[例][ruby]{
# frozen_string_literal: false
original_text = "text"
frozen_text = -original_text
frozen_text.frozen? # => true
original_text == frozen_t......ext # => true
original_text.equal?(frozen_text) # => false
original_text = "text".freeze
frozen_text = -original_text
frozen_text.frozen? # => true
original_text == frozen_text # => true
original_text.equal?(frozen_text) # => true
//}
@see String#+@... -
String
# unpack(template) -> Array (9667.0) -
Array#pack で生成された文字列を テンプレート文字列 template にしたがってアンパックし、 それらの要素を含む配列を返します。
...アンパックし、
それらの要素を含む配列を返します。
@param template pack テンプレート文字列
@return オブジェクトの配列
以下にあげるものは、Array#pack、String#unpack
のテンプレート文字の一覧です。テンプレート文......明中、Array#pack と String#unpack で違いのあるものは `/' で区切って
「Array#pack の説明 / String#unpack の説明」としています。
: a
ASCII文字列(ヌル文字を詰める/後続するヌル文字やスペースを残す)
//emlist[][ruby]{
["abc"].pack("a") # =......"abc ".unpack("a4") # => ["abc "]
//}
: A
ASCII文字列(スペースを詰める/後続するヌル文字やスペースを削除)
//emlist[][ruby]{
["abc"].pack("A") # => "a"
["abc"].pack("A*") # => "abc"
["abc"].pack("A4") # => "abc "
"abc ".unpack("A4") # => ["abc"]
"abc\0".unpack(......ックし、
それらの要素を含む配列を返します。
@param template pack テンプレート文字列
@return オブジェクトの配列
以下にあげるものは、Array#pack、String#unpack、String#unpack1
のテンプレート文字の一覧です。テンプレ... -
String
# partition(sep) -> [String , String , String] (9334.0) -
セパレータ sep が最初に登場する部分で self を 3 つに分割し、 [最初のセパレータより前の部分, セパレータ, それ以降の部分] の 3 要素の配列を返します。
...。
@param sep セパレータを表す文字列か正規表現を指定します。
//emlist[例][ruby]{
p "axaxa".partition("x") # => ["a", "x", "axa"]
p "aaaaa".partition("x") # => ["aaaaa", "", ""]
p "aaaaa".partition("") # => ["", "", "aaaaa"]
//}
@see String#rpartition, String#spl... -
String
# rpartition(sep) -> [String , String , String] (9334.0) -
セパレータ sep が最後に登場する部分で self を 3 つに分割し、 [最後のセパレータより前の部分, セパレータ, それ以降の部分] の 3 要素の配列を返します。
...と第 2 要素が空文字列になります。
@param sep セパレータを表す文字列か正規表現を指定します。
//emlist[例][ruby]{
p "axaxa".rpartition("x") # => ["axa", "x", "a"]
p "aaaaa".rpartition("x") # => ["", "", "aaaaa"]
//}
@see String#partition, String#split... -
String
# %(args) -> String (9324.0) -
printf と同じ規則に従って args をフォーマットします。
...す。
それ以外の場合は Kernel.#sprintf(self, args) と同じです。
@param args フォーマットする値、もしくはその配列
@return フォーマットされた文字列
//emlist[例][ruby]{
p "i = %d" % 10 # => "i = 10"
p "i = %x" % 10 # => "i = a"
p "......= 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が続くとみなせるの... -
String
# scan(pattern) -> [String] | [[String]] (9217.0) -
self に対して pattern を繰り返しマッチし、 マッチした部分文字列の配列を返します。
...、
括弧で括られたパターンにマッチした部分文字列の配列の配列を返します。
@param pattern 探索する部分文字列または正規表現
//emlist[例][ruby]{
p "foobar".scan(/../) # => ["fo", "ob", "ar"]
p "foobar".scan("o") # => ["o",... -
String
# parse _ csv(**options) -> [String] (9192.0) -
CSV.parse_line(self, options) と同様です。
...です。
@param options CSV.new と同様のオプションを指定します。
//emlist[][ruby]{
require "csv"
p "Matz,Ruby\n".parse_csv # => ["Matz", "Ruby"]
p "Matz|Ruby\r\n".parse_csv(col_sep: '|', row_sep: "\r\n") # => ["Matz", "Ruby"]
//}
Ruby 2.6 (CSV......][ruby]{
require 'csv'
p "1,,3\n".parse_csv # => ["1", nil, "3"]
p "1,,3\n".parse_csv(nil_value: Float::NAN) # => ["1", NaN, "3"]
//}
Ruby 2.7 (CSV 3.1.2) から、次のオプションが使えるようになりました。
//emlist[][ruby]{
require 'csv'
p "Matz, Ruby\......n".parse_csv # => ["Matz", " Ruby"]
p "Matz, Ruby\n".parse_csv(strip: true) # => ["Matz", "Ruby"]
//}
@see CSV.new, CSV.parse_line... -
String
# split(sep = $ ; , limit = 0) -> [String] (9192.0) -
第 1 引数 sep で指定されたセパレータによって文字列を limit 個まで分割し、 結果を文字列の配列で返します。 ブロックを指定すると、配列を返す代わりに分割した文字列で ブロックを呼び出します。
...の空文字列を取り除く
: limit < 0
分割個数の制限はなし
@param sep 文字列を分割するときのセパレータのパターン
@param limit 分割する最大個数
//emlist[例][ruby]{
p " a \t b \n c".split(/\s+/) # => ["", "a", "b", "c"]
p " a \t b......][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)......分割個数の制限はなし
@param sep 文字列を分割するときのセパレータのパターン
@param limit 分割する最大個数
@return ブロックを渡した場合は self、ブロックなしの場合は配列
//emlist[例][ruby]{
p " a \t b \n c".split(/\s+...