種類
ライブラリ
- English (6)
- ビルトイン (136)
- benchmark (1)
- bigdecimal (3)
-
bigdecimal
/ util (2) -
cgi
/ html (4) - csv (11)
- date (1)
- dbm (1)
- digest (2)
- etc (2)
- fiddle (2)
- gdbm (2)
- getoptlong (1)
- ipaddr (4)
-
irb
/ cmd / help (1) - json (21)
-
json
/ add / bigdecimal (1) -
json
/ add / complex (1) -
json
/ add / date (1) -
json
/ add / date _ time (1) -
json
/ add / exception (1) -
json
/ add / ostruct (1) -
json
/ add / range (1) -
json
/ add / rational (1) -
json
/ add / regexp (1) -
json
/ add / struct (1) -
json
/ add / symbol (1) -
json
/ add / time (1) - kconv (4)
- logger (1)
- matrix (1)
-
net
/ http (2) -
net
/ imap (1) -
net
/ pop (1) -
net
/ smtp (5) - openssl (41)
- optparse (6)
- pathname (9)
- pstore (3)
- psych (8)
- rake (10)
-
rdoc
/ generator / darkfish (1) -
rdoc
/ generator / json _ index (1) -
rdoc
/ generator / ri (1) -
rdoc
/ markup (4) -
rdoc
/ top _ level (3) - readline (10)
- resolv (1)
- rexml (1)
-
rexml
/ document (9) -
ripper
/ lexer (1) -
rubygems
/ package / tar _ header (1) -
rubygems
/ platform (1) -
rubygems
/ source _ index (1) -
rubygems
/ specification (2) -
rubygems
/ validator (1) -
rubygems
/ version (2) - scanf (1)
- sdbm (2)
- securerandom (1)
- shell (4)
-
shell
/ command-processor (1) -
shell
/ filter (2) - socket (9)
- stringio (10)
- uri (6)
-
webrick
/ httpauth / authenticator (4) -
webrick
/ httputils (1) - win32ole (11)
-
yaml
/ dbm (1)
クラス
-
ARGF
. class (2) - Addrinfo (2)
- Array (8)
-
Benchmark
:: Tms (1) - BigDecimal (5)
- Bignum (2)
- CSV (7)
-
CSV
:: Table (2) - Complex (1)
- DBM (1)
- Date (2)
- DateTime (1)
-
Digest
:: Base (2) - Dir (2)
- Encoding (2)
-
Encoding
:: Converter (6) - Enumerator (2)
- Exception (4)
- FalseClass (2)
-
Fiddle
:: Pointer (2) - File (4)
- Fixnum (2)
- Float (2)
- GDBM (2)
-
Gem
:: Package :: TarHeader (1) -
Gem
:: Platform (1) -
Gem
:: SourceIndex (1) -
Gem
:: Specification (2) -
Gem
:: Validator (1) -
Gem
:: Version (2) - GetoptLong (1)
- Hash (2)
- IPAddr (4)
-
IRB
:: ExtendCommand :: Help (1) - Integer (2)
- Logger (1)
- MatchData (8)
- Matrix (1)
- Module (5)
- NameError (1)
-
Net
:: HTTPResponse (2) -
Net
:: IMAP :: Envelope (1) -
Net
:: POPMail (1) -
Net
:: SMTP (5) - NilClass (1)
- Object (9)
-
OpenSSL
:: ASN1 :: ASN1Data (1) -
OpenSSL
:: BN (1) -
OpenSSL
:: HMAC (3) -
OpenSSL
:: Netscape :: SPKI (4) -
OpenSSL
:: PKCS7 (1) -
OpenSSL
:: PKey :: DSA (8) -
OpenSSL
:: PKey :: RSA (8) -
OpenSSL
:: X509 :: Attribute (1) -
OpenSSL
:: X509 :: Certificate (6) -
OpenSSL
:: X509 :: Extension (1) -
OpenSSL
:: X509 :: ExtensionFactory (3) -
OpenSSL
:: X509 :: Name (3) - OpenStruct (1)
- OptionParser (4)
-
OptionParser
:: ParseError (2) - PStore (3)
- Pathname (9)
- Proc (3)
-
Process
:: Status (1) -
Psych
:: Nodes :: Node (2) -
Psych
:: ScalarScanner (1) -
Psych
:: Visitors :: YAMLTree (1) -
RDoc
:: Generator :: Darkfish (1) -
RDoc
:: Generator :: JsonIndex (1) -
RDoc
:: Generator :: RI (1) -
RDoc
:: Markup (3) -
RDoc
:: TopLevel (3) -
REXML
:: Attribute (2) -
REXML
:: CData (2) -
REXML
:: Declaration (1) -
REXML
:: Element (1) -
REXML
:: ExternalEntity (1) -
REXML
:: NotationDecl (1) -
REXML
:: ParseException (1) -
REXML
:: Text (1) -
Rake
:: Application (1) -
Rake
:: EarlyTime (1) -
Rake
:: FileList (1) -
Rake
:: InvocationChain (1) -
Rake
:: InvocationChain :: EmptyInvocationChain (1) -
Rake
:: Task (1) -
Rake
:: TaskArguments (2) - Range (3)
- Rational (3)
- Regexp (1)
-
Resolv
:: DNS :: Name (1) - Ripper (1)
- SDBM (2)
-
Scanf
:: FormatString (1) - Shell (4)
-
Shell
:: CommandProcessor (1) -
Shell
:: Filter (2) - Socket (2)
-
Socket
:: Option (2) - String (27)
- StringIO (10)
- Struct (5)
- Symbol (13)
- Thread (1)
-
Thread
:: Backtrace :: Location (3) - Time (1)
- TracePoint (2)
- TrueClass (1)
- UDPSocket (3)
-
URI
:: Generic (2) -
URI
:: MailTo (4) -
WEBrick
:: HTTPUtils :: FormData (1) -
WIN32OLE
_ METHOD (3) -
WIN32OLE
_ PARAM (2) -
WIN32OLE
_ TYPE (2) -
WIN32OLE
_ TYPELIB (2) -
WIN32OLE
_ VARIABLE (2) -
YAML
:: DBM (1)
モジュール
-
CGI
:: HtmlExtension (4) - Etc (2)
- JSON (5)
-
JSON
:: Generator :: GeneratorMethods :: Array (1) -
JSON
:: Generator :: GeneratorMethods :: FalseClass (1) -
JSON
:: Generator :: GeneratorMethods :: Float (1) -
JSON
:: Generator :: GeneratorMethods :: Hash (1) -
JSON
:: Generator :: GeneratorMethods :: Integer (1) -
JSON
:: Generator :: GeneratorMethods :: NilClass (1) -
JSON
:: Generator :: GeneratorMethods :: Object (1) -
JSON
:: Generator :: GeneratorMethods :: String (3) -
JSON
:: Generator :: GeneratorMethods :: String :: Extend (1) -
JSON
:: Generator :: GeneratorMethods :: TrueClass (1) - Kconv (2)
- Kernel (17)
- Marshal (1)
- Psych (2)
- Rake (1)
- Readline (1)
-
WEBrick
:: HTTPAuth :: Authenticator (4)
オブジェクト
- ENV (7)
-
Readline
:: HISTORY (9)
キーワード
-
$ FIELD _ SEPARATOR (1) -
$ FS (1) -
$ INPUT _ RECORD _ SEPARATOR (1) -
$ OUTPUT _ FIELD _ SEPARATOR (1) -
$ OUTPUT _ RECORD _ SEPARATOR (1) -
$ RS (1) - % (1)
- * (2)
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (1) - << (1)
- ASN1 (1)
- CSV (1)
- DESCRIPTION (1)
-
EMPTY
_ MARSHAL _ CHECKSUM (1) -
EMPTY
_ MARSHAL _ DATA (1) - Enumerator (1)
- Extend (2)
- Float (1)
-
GENERATOR
_ DIR (1) - HeaderConverters (1)
- Integer (1)
- Markup (1)
-
NEWS for Ruby 2
. 0 . 0 (1) -
NEWS for Ruby 2
. 1 . 0 (1) - RequestField (1)
- ResponseField (1)
- ResponseInfoField (1)
- Ruby用語集 (1)
-
SC
_ MONOTONIC _ CLOCK (1) -
SC
_ THREAD _ DESTRUCTOR _ ITERATIONS (1) -
SEARCH
_ INDEX _ FILE (1) - STR2CSTR (1)
- SafeStringValue (1)
- SecureRandom (1)
- StringValue (1)
- StringValuePtr (1)
- [] (9)
- []= (3)
-
absolute
_ path (1) -
add
_ element (1) -
add
_ html (1) -
add
_ special (1) -
add
_ word _ pair (1) - autoload (2)
- autoload? (2)
- autorequire (1)
- bigdecimal (1)
-
bigdecimal
/ util (1) - binread (1)
- binwrite (1)
- bytes (3)
- caller (3)
- capitalize (1)
- captures (1)
- casecmp (1)
- chars (3)
- clone (1)
- codepoints (3)
-
col
_ sep (1) -
create
_ ext _ from _ string (1) -
create
_ extension (2) -
create
_ id (1) - data (1)
-
default
_ record _ separator (1) -
default
_ record _ separator= (1) -
define
_ singleton _ method (2) -
delete
_ at (1) - downcase (1)
- dump (2)
- dup (1)
- each (3)
-
each
_ byte (2) -
each
_ char (2) -
each
_ codepoint (3) -
each
_ line (3) - echo (3)
- execute (1)
- export (4)
- extname (1)
- fetch (1)
-
file
_ absolute _ name (1) -
file
_ relative _ name (1) - format (1)
- formatter (1)
- ftype (1)
-
full
_ name (1) - generate (1)
- getaddrinfo (1)
- getservbyport (1)
- gsub (2)
- gsub! (1)
- headers (1)
- help (1)
- helpstring (1)
- hex (1)
- hexdigest (2)
- hton (1)
- id2name (1)
-
in
_ reply _ to (1) - index (1)
-
insert
_ output (1) - inspect (16)
-
installed
_ spec _ directories (1) - irb (1)
- join (2)
-
json
_ create (1) - kconv (2)
- key (1)
- lines (3)
- logger (1)
- match (1)
- name (7)
-
net
/ smtp (1) - new (10)
- next (1)
- normalize (1)
- normalize! (1)
- ntop (1)
- open (4)
-
original
_ dir (2) - pack (1)
- pack テンプレート文字列 (1)
- path (5)
- pathmap (1)
- pop (1)
-
pretty
_ generate (1) -
pretty
_ unparse (1) -
program
_ name (1) -
psych
_ to _ yaml (1) -
public
_ method (1) - push (1)
- putback (2)
-
rb
_ to _ id (1) - rdoc (1)
-
rdoc
/ markup / to _ ansi (1) -
rdoc
/ markup / to _ bs (1) -
rdoc
/ markup / to _ html (1) - read (1)
-
read
_ body (2) - readline (1)
- readlines (1)
- realm (1)
-
record
_ separator (1) -
remove
_ leading _ dot _ dir (1) - restore (1)
-
ruby 1
. 6 feature (1) -
ruby 1
. 8 . 2 feature (1) -
ruby 1
. 8 . 3 feature (1) -
ruby 1
. 8 . 4 feature (1) -
ruby 1
. 9 feature (1) -
rubygems
/ commands / list _ command (1) -
rubygems
/ commands / search _ command (1) - send (3)
-
send
_ mail (1) - sendmail (1)
-
set
_ backtrace (1) - shift (1)
-
singleton
_ class (1) -
singleton
_ method (1) - slice (1)
-
source
_ location (1) - split (1)
- sprintf (1)
- sprintf フォーマット (1)
- start (2)
- store (4)
- succ (1)
- swapcase (1)
-
to
_ a (9) -
to
_ csv (2) -
to
_ d (1) -
to
_ der (7) -
to
_ digits (1) -
to
_ f (1) -
to
_ i (1) -
to
_ json (21) -
to
_ json _ raw (1) -
to
_ json _ raw _ object (1) -
to
_ mailtext (1) -
to
_ path (3) -
to
_ pem (6) -
to
_ r (1) -
to
_ rfc822text (1) -
to
_ ruby (1) -
to
_ s (66) -
to
_ sockaddr (1) -
to
_ string (2) -
to
_ text (4) -
to
_ yaml (2) -
tokadd
_ string (1) - tokenize (2)
- tolocale (2)
- top (1)
-
try
_ convert (1) - unpack (1)
- unparse (1)
- upcase (1)
- upto (1)
- value (2)
-
values
_ at (2) - verify (1)
- version (1)
-
with
_ object (2) - write (2)
- yaml (1)
- クラス/メソッドの定義 (1)
- 正規表現 (1)
検索結果
先頭5件
-
String
# tolocale -> String (99922.0) -
self のエンコーディングをロケールエンコーディングに変換した文字列を 返します。変換元のエンコーディングは文字列の内容から推測します。
self のエンコーディングをロケールエンコーディングに変換した文字列を
返します。変換元のエンコーディングは文字列の内容から推測します。
ロケールエンコーディングについては Encoding.locale_charmap を見てください。
このメソッドは MIME エンコードされた文字列を展開し、
いわゆる半角カナを全角に変換します。
これらを変換したくない場合は、 String#encode
を使ってください。
@see Kconv.#tolocale -
JSON
:: Ext :: Generator :: GeneratorMethods :: String (90049.0) -
Alias of JSON::Generator::GeneratorMethods::String
Alias of JSON::Generator::GeneratorMethods::String -
JSON
:: Generator :: GeneratorMethods :: String (90049.0) -
String に JSON で使用するインスタンスメソッドを追加するためのモジュールです。
String に JSON で使用するインスタンスメソッドを追加するためのモジュールです。 -
String
# unpack(template) -> Array (82777.0) -
Array#pack で生成された文字列を テンプレート文字列 template にしたがってアンパックし、 それらの要素を含む配列を返します。
Array#pack で生成された文字列を
テンプレート文字列 template にしたがってアンパックし、
それらの要素を含む配列を返します。
@param template pack テンプレート文字列
@return オブジェクトの配列
以下にあげるものは、Array#pack、String#unpack
のテンプレート文字の一覧です。テンプレート文字は後に「長さ」を表す数字
を続けることができます。「長さ」の代わりに`*'とすることで「残り全て」
を表すこともできます。
長さの意味はテンプレート文字により異なりますが大抵、
"iiii"
のよう... -
String
# to _ i(base = 10) -> Integer (82036.0) -
文字列を 10 進数表現された整数であると解釈して、整数に変換します。
文字列を 10 進数表現された整数であると解釈して、整数に変換します。
//emlist[例][ruby]{
p " 10".to_i # => 10
p "+10".to_i # => 10
p "-10".to_i # => -10
p "010".to_i # => 10
p "-010".to_i # => -10
//}
整数とみなせない文字があればそこまでを変換対象とします。
変換対象が空文字列であれば 0 を返します。
//emlist[例][ruby]{
p "0x11".to_i # => 0
p "".to_i # =>... -
String
# to _ f -> Float (81928.0) -
文字列を 10 進数表現と解釈して、浮動小数点数 Float に変換します。
文字列を 10 進数表現と解釈して、浮動小数点数 Float に変換します。
浮動小数点数とみなせなくなるところまでを変換対象とします。
途中に変換できないような文字列がある場合、それより先の文字列は無視されます。
//emlist[][ruby]{
p "-10".to_f # => -10.0
p "10e2".to_f # => 1000.0
p "1e-2".to_f # => 0.01
p ".1".to_f # => 0.1
p "1_0_0".to_f # => 100.0 # 数値リテラルと同じように区切りに _ を使える
p " \n10".to_f ... -
String
# to _ r -> Rational (81802.0) -
自身を有理数(Rational)に変換した結果を返します。
自身を有理数(Rational)に変換した結果を返します。
Kernel.#Rational に文字列を指定した時のように、以下のいずれかの形
式で指定します。
* "1/3" のような分数の形式
* "0.3" のような10進数の形式
* "0.3E0" のような x.xEn の形式
* 数字をアンダースコアで繋いだ形式
//emlist[例][ruby]{
' 2 '.to_r # => (2/1)
'1/3'.to_r # => (1/3)
'-9.2'.to_r # => (-46/5)
'-9.2E2'.to_r ... -
String
# each _ line(rs = $ / ) -> Enumerator (81799.0) -
文字列中の各行に対して繰り返します。 行の区切りは rs に指定した文字列で、 そのデフォルト値は変数 $/ の値です。 各 line には区切りの文字列も含みます。
文字列中の各行に対して繰り返します。
行の区切りは rs に指定した文字列で、
そのデフォルト値は変数 $/ の値です。
各 line には区切りの文字列も含みます。
rs に nil を指定すると行区切りなしとみなします。
rs に空文字列 "" を指定すると「パラグラフモード」になり、
改行コードが 2 つ以上連続するところで文字列を分割します
(つまり空行で分割します)。
@param rs 行末を示す文字列
//emlist[例][ruby]{
"aa\nbb\ncc\n".each_line do |line|
p line
end
# => "aa\n"
... -
String
# chars -> [String] (81736.0) -
文字列の各文字を文字列の配列で返します。(self.each_char.to_a と同じです)
文字列の各文字を文字列の配列で返します。(self.each_char.to_a と同じです)
//emlist[例][ruby]{
"hello世界".chars # => ["h", "e", "l", "l", "o", "世", "界"]
//}
ブロックが指定された場合は String#each_char と同じように動作します。
Ruby 2.6 までは deprecated の警告が出ますが、Ruby 2.7 で警告は削除されました。
@see String#each_char -
String
# pathmap(spec = nil) { . . . } -> String (81730.0) -
与えられた書式指定文字列に応じてパス(自身)を変換します。
与えられた書式指定文字列に応じてパス(自身)を変換します。
与えられた書式指定文字列は変換の詳細を制御します。
指定できる書式指定文字列は以下の通りです。
: %p
完全なパスを表します。
: %f
拡張子付きのファイル名を表します。ディレクトリ名は含まれません。
: %n
拡張子なしのファイル名を表します。
: %d
パスに含まれるディレクトリのリストを表します。
: %x
パスに含まれるファイルの拡張子を表します。拡張子が無い場合は空文字列を表します。
: %X
拡張子以外すべてを表します。
: %s
定義されていれば、代替のファイルセパレータを表します。... -
String
# upto(max , exclusive = false) {|s| . . . } -> self (81703.0) -
self から始めて max まで 「次の文字列」を順番にブロックに与えて繰り返します。 「次」の定義については String#succ を参照してください。
self から始めて max まで
「次の文字列」を順番にブロックに与えて繰り返します。
「次」の定義については String#succ を参照してください。
たとえば以下のコードは a, b, c, ... z, aa, ... az, ..., za を
出力します。
//emlist[][ruby]{
("a" .. "za").each do |str|
puts str
end
'a'.upto('za') do |str|
puts str
end
//}
@param max 繰り返しをやめる文字列
@param exclusive max を含むかどうか... -
String
# each _ codepoint -> Enumerator (81691.0) -
文字列の各コードポイントに対して繰り返します。
文字列の各コードポイントに対して繰り返します。
UTF-8/UTF-16(BE|LE)/UTF-32(BE|LE) 以外のエンコーディングに対しては
各文字のバイナリ表現由来の値になります。
//emlist[例][ruby]{
#coding:UTF-8
"hello わーるど".each_codepoint.to_a
# => [104, 101, 108, 108, 111, 32, 12431, 12540, 12427, 12393]
"hello わーるど".encode('euc-jp').each_codepoint.to_a
# => [104, 101, 108, 1... -
String
# each _ byte -> Enumerator (81619.0) -
文字列の各バイトに対して繰り返します。
文字列の各バイトに対して繰り返します。
//emlist[例][ruby]{
"str".each_byte do |byte|
p byte
end
# => 115
# => 116
# => 114
"あ".each_byte do |byte|
p byte
end
# => 227
# => 129
# => 130
//}
@see String#bytes -
String
# each _ char -> Enumerator (81619.0) -
文字列の各文字に対して繰り返します。
文字列の各文字に対して繰り返します。
たとえば、
//emlist[][ruby]{
"hello世界".each_char {|c| print c, ' ' }
//}
は次のように出力されます。
h e l l o 世 界
@see String#chars -
String
# to _ d -> BigDecimal (81604.0) -
自身を BigDecimal に変換します。BigDecimal(self) と同じです。
自身を BigDecimal に変換します。BigDecimal(self) と同じです。
@return BigDecimal に変換したオブジェクト -
String
# each _ line(rs = $ / ) {|line| . . . } -> self (81499.0) -
文字列中の各行に対して繰り返します。 行の区切りは rs に指定した文字列で、 そのデフォルト値は変数 $/ の値です。 各 line には区切りの文字列も含みます。
文字列中の各行に対して繰り返します。
行の区切りは rs に指定した文字列で、
そのデフォルト値は変数 $/ の値です。
各 line には区切りの文字列も含みます。
rs に nil を指定すると行区切りなしとみなします。
rs に空文字列 "" を指定すると「パラグラフモード」になり、
改行コードが 2 つ以上連続するところで文字列を分割します
(つまり空行で分割します)。
@param rs 行末を示す文字列
//emlist[例][ruby]{
"aa\nbb\ncc\n".each_line do |line|
p line
end
# => "aa\n"
... -
String
# chars {|cstr| block } -> self (81436.0) -
文字列の各文字を文字列の配列で返します。(self.each_char.to_a と同じです)
文字列の各文字を文字列の配列で返します。(self.each_char.to_a と同じです)
//emlist[例][ruby]{
"hello世界".chars # => ["h", "e", "l", "l", "o", "世", "界"]
//}
ブロックが指定された場合は String#each_char と同じように動作します。
Ruby 2.6 までは deprecated の警告が出ますが、Ruby 2.7 で警告は削除されました。
@see String#each_char -
String
# each _ codepoint {|codepoint| block } -> self (81391.0) -
文字列の各コードポイントに対して繰り返します。
文字列の各コードポイントに対して繰り返します。
UTF-8/UTF-16(BE|LE)/UTF-32(BE|LE) 以外のエンコーディングに対しては
各文字のバイナリ表現由来の値になります。
//emlist[例][ruby]{
#coding:UTF-8
"hello わーるど".each_codepoint.to_a
# => [104, 101, 108, 108, 111, 32, 12431, 12540, 12427, 12393]
"hello わーるど".encode('euc-jp').each_codepoint.to_a
# => [104, 101, 108, 1... -
JSON
:: Generator :: GeneratorMethods :: String # to _ json _ raw -> String (73105.0) -
自身に対して JSON::Generator::GeneratorMethods::String#to_json_raw_object を呼び出して JSON::Generator::GeneratorMethods::Hash#to_json した結果を返します。
自身に対して JSON::Generator::GeneratorMethods::String#to_json_raw_object を呼び出して JSON::Generator::GeneratorMethods::Hash#to_json した結果を返します。
@see JSON::Generator::GeneratorMethods::String#to_json_raw_object, JSON::Generator::GeneratorMethods::Hash#to_json -
JSON
:: Generator :: GeneratorMethods :: String # to _ json _ raw _ object -> Hash (72658.0) -
生の文字列を格納したハッシュを生成します。
生の文字列を格納したハッシュを生成します。
このメソッドは UTF-8 の文字列ではなく生の文字列を JSON に変換する場合に使用してください。
require 'json'
"にほんご".encode("euc-jp").to_json_raw_object
# => {"json_class"=>"String", "raw"=>[164, 203, 164, 219, 164, 243, 164, 180]}
"にほんご".encode("euc-jp").to_json # source sequence is illegal/malformed (JSON::... -
URI
:: MailTo # to -> String (72625.0) -
自身の e-mail アドレスを文字列で返します。
自身の e-mail アドレスを文字列で返します。
例:
require 'uri'
p URI.parse("mailto:nospam@example.com").to #=> "nospam@example.com" -
JSON
:: Generator :: GeneratorMethods :: String # to _ json(state _ or _ hash = nil) -> String (63979.0) -
自身から生成した JSON 形式の文字列を返します。
自身から生成した JSON 形式の文字列を返します。
自身のエンコードは UTF-8 であるべきです。
"\u????" のように UTF-16 ビッグエンディアンでエンコードされた文字列を返すことがあります。
@param state_or_hash 生成する JSON 形式の文字列をカスタマイズするため
に JSON::State のインスタンスか、
JSON::State.new の引数と同じ Hash を
指定します。
//emlist[例][ruby]... -
String
# %(args) -> String (63964.0) -
printf と同じ規則に従って args をフォーマットします。
printf と同じ規則に従って args をフォーマットします。
args が配列であれば Kernel.#sprintf(self, *args) と同じです。
それ以外の場合は Kernel.#sprintf(self, args) と同じです。
@param args フォーマットする値、もしくはその配列
@return フォーマットされた文字列
//emlist[例][ruby]{
p "i = %d" % 10 # => "i = 10"
p "i = %x" % 10 # => "i = a"
p "i = %o" % 10... -
String
# gsub!(pattern) -> Enumerator (63955.0) -
文字列中で pattern にマッチする部分全てを順番にブロックに渡し、 その評価結果に置き換えます。
文字列中で pattern にマッチする部分全てを順番にブロックに渡し、
その評価結果に置き換えます。
また、ブロックなしの場合と違い、ブロックの中からは
組み込み変数 $1, $2, $3, ... を問題なく参照できます。
@param pattern 置き換える文字列のパターンを表す文字列か正規表現。
文字列を指定した場合は全く同じ文字列にだけマッチする
@return 置換した場合は self、置換しなかった場合は nil
//emlist[例][ruby]{
str = 'abcabc'
str.gsub!(/b/) {|s| s.u... -
String
# gsub(pattern) -> Enumerator (63955.0) -
文字列中で pattern にマッチした部分を順番にブロックに渡し、 その実行結果で置き換えた文字列を生成して返します。 ブロックなしの場合と違い、ブロックの中からは 組み込み変数 $1, $2, $3, ... を問題なく参照できます。
文字列中で pattern にマッチした部分を順番にブロックに渡し、
その実行結果で置き換えた文字列を生成して返します。
ブロックなしの場合と違い、ブロックの中からは
組み込み変数 $1, $2, $3, ... を問題なく参照できます。
@param pattern 置き換える文字列のパターンを表す文字列か正規表現。
文字列を指定した場合は全く同じ文字列にだけマッチする
@return 新しい文字列
//emlist[例][ruby]{
p 'abcabc'.gsub(/[bc]/) {|s| s.upcase } #=> "aBCaBC"
... -
JSON
:: Generator :: GeneratorMethods :: Float # to _ json(state _ or _ hash = nil) -> String (63925.0) -
自身から生成した JSON 形式の文字列を返します。
自身から生成した JSON 形式の文字列を返します。
@param state_or_hash 生成する JSON 形式の文字列をカスタマイズするため
に JSON::State のインスタンスか、
JSON::State.new の引数と同じ Hash を
指定します。
//emlist[例][ruby]{
require "json"
(1.0).to_json # => "1.0"
//} -
String
# kconv(out _ code , in _ code = Kconv :: AUTO) -> String (63904.0) -
self のエンコーディングを out_code に変換した文字列を 返します。 out_code in_code は Kconv の定数で指定します。
self のエンコーディングを out_code に変換した文字列を
返します。
out_code in_code は Kconv の定数で指定します。
このメソッドは MIME エンコードされた文字列を展開し、
いわゆる半角カナを全角に変換します。
これらを変換したくない場合は、 NKF.#nkf を使ってください。
@param out_code 変換後のエンコーディングを Kconv の定数で指定します。
@param in_code 変換する文字列のエンコーディングを Kconv の定数で指定します。
@see Kconv.#kconv -
JSON
:: Generator :: GeneratorMethods :: String :: Extend . json _ create(hash) -> String (63622.0) -
JSON のオブジェクトから Ruby の文字列を生成して返します。
JSON のオブジェクトから Ruby の文字列を生成して返します。
@param hash キーとして "raw" という文字列を持ち、その値として数値の配列を持つハッシュを指定します。
require 'json'
String.json_create({"raw" => [0x41, 0x42, 0x43]}) # => "ABC" -
String
# lines(rs = $ / ) -> [String] (63436.0) -
文字列中の各行を文字列の配列で返します。(self.each_line.to_a と同じです)
文字列中の各行を文字列の配列で返します。(self.each_line.to_a と同じです)
//emlist[][ruby]{
"aa\nbb\ncc\n".lines # => ["aa\n", "bb\n", "cc\n"]
//}
行の区切りは rs に指定した文字列で、 そのデフォルト値は変数 $/ の値です。
各 line には区切りの文字列も含みます。
rs に nil を指定すると行区切りなしとみなします。 rs に空文字列 "" を指
定すると「パラグラフモード」になり、 改行コードが 2 つ以上連続するとこ
ろで文字列を分割します (つまり空行で分割します)。
... -
String
# hex -> Integer (63175.0) -
文字列に 16 進数で数値が表現されていると解釈して整数に変換します。 接頭辞 "0x", "0X" とアンダースコアは無視されます。 文字列が [_0-9a-fA-F] 以外の文字を含むときはその文字以降を無視します。
文字列に 16 進数で数値が表現されていると解釈して整数に変換します。
接頭辞 "0x", "0X" とアンダースコアは無視されます。
文字列が [_0-9a-fA-F] 以外の文字を含むときはその文字以降を無視します。
self が空文字列のときは 0 を返します。
//emlist[例][ruby]{
p "10".hex # => 16
p "ff".hex # => 255
p "0x10".hex # => 16
p "-0x10".hex # => -16
p "xyz".hex # => 0
p "10z".hex # => 16
p "1_0".h... -
String
# lines(rs = $ / ) {|line| . . . } -> self (63136.0) -
文字列中の各行を文字列の配列で返します。(self.each_line.to_a と同じです)
文字列中の各行を文字列の配列で返します。(self.each_line.to_a と同じです)
//emlist[][ruby]{
"aa\nbb\ncc\n".lines # => ["aa\n", "bb\n", "cc\n"]
//}
行の区切りは rs に指定した文字列で、 そのデフォルト値は変数 $/ の値です。
各 line には区切りの文字列も含みます。
rs に nil を指定すると行区切りなしとみなします。 rs に空文字列 "" を指
定すると「パラグラフモード」になり、 改行コードが 2 つ以上連続するとこ
ろで文字列を分割します (つまり空行で分割します)。
... -
String
# bytes -> [Integer] (63133.0) -
文字列の各バイトを数値の配列で返します。(self.each_byte.to_a と同じです)
文字列の各バイトを数値の配列で返します。(self.each_byte.to_a と同じです)
//emlist[例][ruby]{
"str".bytes # => [115, 116, 114]
//}
ブロックが指定された場合は String#each_byte と同じように動作します。
Ruby 2.6 までは deprecated の警告が出ますが、Ruby 2.7 で警告は削除されました。
@see String#each_byte -
String
# bytes {|byte| . . . } -> self (63133.0) -
文字列の各バイトを数値の配列で返します。(self.each_byte.to_a と同じです)
文字列の各バイトを数値の配列で返します。(self.each_byte.to_a と同じです)
//emlist[例][ruby]{
"str".bytes # => [115, 116, 114]
//}
ブロックが指定された場合は String#each_byte と同じように動作します。
Ruby 2.6 までは deprecated の警告が出ますが、Ruby 2.7 で警告は削除されました。
@see String#each_byte -
String
# codepoints -> [Integer] (63133.0) -
文字列の各コードポイントの配列を返します。(self.each_codepoint.to_a と同じです)
文字列の各コードポイントの配列を返します。(self.each_codepoint.to_a と同じです)
//emlist[例][ruby]{
#coding:UTF-8
"hello わーるど".codepoints
# => [104, 101, 108, 108, 111, 32, 12431, 12540, 12427, 12393]
//}
ブロックが指定された場合は String#each_codepoint と同じように動作します。
Ruby 2.6 までは deprecated の警告が出ますが、Ruby 2.7 で警告は削除されました。
@see String#e... -
String
# codepoints {|codepoint| block } -> self (63133.0) -
文字列の各コードポイントの配列を返します。(self.each_codepoint.to_a と同じです)
文字列の各コードポイントの配列を返します。(self.each_codepoint.to_a と同じです)
//emlist[例][ruby]{
#coding:UTF-8
"hello わーるど".codepoints
# => [104, 101, 108, 108, 111, 32, 12431, 12540, 12427, 12393]
//}
ブロックが指定された場合は String#each_codepoint と同じように動作します。
Ruby 2.6 までは deprecated の警告が出ますが、Ruby 2.7 で警告は削除されました。
@see String#e... -
Kernel
. # String(arg) -> String (55063.0) -
引数を文字列(String)に変換した結果を返します。
引数を文字列(String)に変換した結果を返します。
arg.to_s を呼び出して文字列に変換します。
arg が文字列の場合、何もせず arg を返します。
@param arg 変換対象のオブジェクトです。
@raise TypeError to_s の返り値が文字列でなければ発生します。
//emlist[例][ruby]{
class Foo
def to_s
"hogehoge"
end
end
arg = Foo.new
p String(arg) #=> "hogehoge"
//}
@see Object#to_s,String -
JSON
:: Generator :: GeneratorMethods :: Object # to _ json(state _ or _ hash = nil) -> String (55009.0) -
自身を to_s で文字列にした結果を JSON 形式の文字列に変換して返します。
自身を to_s で文字列にした結果を JSON 形式の文字列に変換して返します。
このメソッドはあるオブジェクトに to_json メソッドが定義されていない場合に使用する
フォールバックのためのメソッドです。
@param state_or_hash 生成する JSON 形式の文字列をカスタマイズするため
に JSON::State のインスタンスか、
JSON::State.new の引数と同じ Hash を
指定します。
//emlist[例][ruby... -
URI
:: MailTo # to _ mailtext -> String (54967.0) -
URI オブジェクトからメールテキスト文字列を生成します。
URI オブジェクトからメールテキスト文字列を生成します。
例:
require 'uri'
p mailto = URI.parse("mailto:ruby-list@ruby-lang.org?subject=subscribe&cc=myaddr")
print mailto.to_mailtext
=> #<URI::MailTo:0x20104a0e URL:mailto:ruby-list@ruby-lang.org?subject=subscribe&cc=myaddr>
To: ruby-list@ruby-lang.org
Sub... -
JSON
:: Generator :: GeneratorMethods :: Array # to _ json(state _ or _ hash = nil) -> String (54925.0) -
自身から生成した JSON 形式の文字列を返します。
自身から生成した JSON 形式の文字列を返します。
@param state_or_hash 生成する JSON 形式の文字列をカスタマイズするため
に JSON::State のインスタンスか、
JSON::State.new の引数と同じ Hash を
指定します。
//emlist[例][ruby]{
require "json"
[1, 2, 3].to_json # => "[1,2,3]"
//} -
JSON
:: Generator :: GeneratorMethods :: FalseClass # to _ json(state _ or _ hash = nil) -> String (54925.0) -
自身から生成した JSON 形式の文字列を返します。
自身から生成した JSON 形式の文字列を返します。
"false" という文字列を返します。
@param state_or_hash 生成する JSON 形式の文字列をカスタマイズするため
に JSON::State のインスタンスか、
JSON::State.new の引数と同じ Hash を
指定します。
//emlist[例][ruby]{
require "json"
false.to_json # => "false"
//} -
JSON
:: Generator :: GeneratorMethods :: Hash # to _ json(state _ or _ hash = nil) -> String (54925.0) -
自身から生成した JSON 形式の文字列を返します。
自身から生成した JSON 形式の文字列を返します。
@param state_or_hash 生成する JSON 形式の文字列をカスタマイズするため
に JSON::State のインスタンスか、
JSON::State.new の引数と同じ Hash を
指定します。
//emlist[例][ruby]{
require "json"
person = { "name" => "tanaka", "age" => 19 }
person.to_json # ... -
JSON
:: Generator :: GeneratorMethods :: Integer # to _ json(state _ or _ hash = nil) -> String (54925.0) -
自身から生成した JSON 形式の文字列を返します。
自身から生成した JSON 形式の文字列を返します。
@param state_or_hash 生成する JSON 形式の文字列をカスタマイズするため
に JSON::State のインスタンスか、
JSON::State.new の引数と同じ Hash を
指定します。
//emlist[例][ruby]{
require "json"
10.to_json # => "10"
//} -
JSON
:: Generator :: GeneratorMethods :: NilClass # to _ json(state _ or _ hash = nil) -> String (54925.0) -
自身から生成した JSON 形式の文字列を返します。
自身から生成した JSON 形式の文字列を返します。
"null" という文字列を返します。
@param state_or_hash 生成する JSON 形式の文字列をカスタマイズするため
に JSON::State のインスタンスか、
JSON::State.new の引数と同じ Hash を
指定します。
//emlist[例][ruby]{
require "json"
nil.to_json # => "null"
//} -
JSON
:: Generator :: GeneratorMethods :: TrueClass # to _ json(state _ or _ hash = nil) -> String (54925.0) -
自身から生成した JSON 形式の文字列を返します。
自身から生成した JSON 形式の文字列を返します。
"true" という文字列を返します。
@param state_or_hash 生成する JSON 形式の文字列をカスタマイズするため
に JSON::State のインスタンスか、
JSON::State.new の引数と同じ Hash を
指定します。
//emlist[例][ruby]{
require "json"
true.to_json # => "true"
//} -
RDoc
:: Generator :: Darkfish :: GENERATOR _ DIR -> String (54904.0) -
このファイルの親ディレクトリへのパスを表す文字列です。
このファイルの親ディレクトリへのパスを表す文字列です。
テンプレートなどのリソースを検索するのに内部で使用します。 -
static int tokadd
_ string(int func , int term , int paren) (54901.0) -
-
IPAddr
# to _ string -> String (45982.0) -
標準的な文字列表現に変換します。
標準的な文字列表現に変換します。
require 'ipaddr'
addr6 = IPAddr.new('::1')
addr6.to_s #=> "::1"
addr6.to_string #=> "0000:0000:0000:0000:0000:0000:0000:0001"
@see IPAddr#to_s -
Pathname
# to _ path -> String (45973.0) -
File.open などの引数に渡す際に呼ばれるメソッドです。 Pathname オブジェ クトにおいては、 to_s と同じです。
File.open などの引数に渡す際に呼ばれるメソッドです。 Pathname オブジェ
クトにおいては、 to_s と同じです。
@see Pathname#to_s -
MatchData
# to _ a -> [String] (45946.0) -
$&, $1, $2,... を格納した配列を返します。
$&, $1, $2,... を格納した配列を返します。
//emlist[例][ruby]{
/(foo)(bar)(BAZ)?/ =~ "foobarbaz"
p $~.to_a # => ["foobar", "foo", "bar", nil]
//}
@see MatchData#captures -
REXML
:: Attribute # to _ string -> String (45946.0) -
"name='value'" という形式の文字列を返します。
"name='value'" という形式の文字列を返します。
//emlist[][ruby]{
require 'rexml/document'
e = REXML::Element.new("el")
e.add_attribute("ns:r", "rval")
p e.attributes.get_attribute("r").to_string # => "ns:r='rval'"
//} -
URI
:: MailTo # to _ rfc822text -> String (45667.0) -
URI オブジェクトからメールテキスト文字列を生成します。
URI オブジェクトからメールテキスト文字列を生成します。
例:
require 'uri'
p mailto = URI.parse("mailto:ruby-list@ruby-lang.org?subject=subscribe&cc=myaddr")
print mailto.to_mailtext
=> #<URI::MailTo:0x20104a0e URL:mailto:ruby-list@ruby-lang.org?subject=subscribe&cc=myaddr>
To: ruby-list@ruby-lang.org
Sub... -
OpenSSL
:: X509 :: ExtensionFactory # create _ ext _ from _ string(str) -> OpenSSL :: X509 :: Extension (45604.0) -
文字列から OpenSSL::X509::Extension オブジェクトを生成します。
文字列から OpenSSL::X509::Extension オブジェクトを生成します。
文字列は "oid = value" もしくは "oid = critical, value" という
形式である必要があります。
@param str 生成する拡張領域のデータの文字列
@see OpenSSL::X509::ExtensionFactory#create_ext -
JSON
:: Ext :: Generator :: GeneratorMethods :: String :: Extend (45049.0) -
Alias of JSON::Generator::GeneratorMethods::String::Extend
Alias of JSON::Generator::GeneratorMethods::String::Extend -
JSON
:: Generator :: GeneratorMethods :: String :: Extend (45049.0) -
String に JSON で使用する特異メソッドを追加するためのモジュールです。
String に JSON で使用する特異メソッドを追加するためのモジュールです。 -
void StringValue(VALUE val) (37345.0)
-
val が String でなければ to_str メソッドを使って String に変換します。
val が String でなければ to_str メソッドを使って String に変換します。
このマクロに渡した VALUE は ruby の GC から確実に保護されます。 -
Exception
# set _ backtrace(errinfo) -> nil | String | [String] (37279.0) -
バックトレース情報に errinfo を設定し、設定されたバックトレース 情報を返します。
バックトレース情報に errinfo を設定し、設定されたバックトレース
情報を返します。
@param errinfo nil、String あるいは String の配列のいずれかを指定します。
//emlist[例][ruby]{
begin
begin
raise "inner"
rescue
raise "outer"
end
rescue
$!.backtrace # => ["/path/to/test.rb:5:in `rescue in <main>'", "/path/to/test.rb:2:in `<main>'"]
$!.se... -
OpenSSL
:: X509 :: Name # to _ a -> [[String , String , Integer]] (37249.0) -
内容を配列にして返します。
内容を配列にして返します。
配列の各要素は、[属性型文字列、属性値文字列、属性値の型を表す整数(OpenSSL::ASN1以下の各定数で定義されているASN1の型)] という3要素の配列です。
例:
require 'openssl'
n = OpenSSL::X509::Name.parse('/C=JP/ST=Kanagawa/L=Yokohama/O=Example Company/OU=Lab3/CN=foobar/emailAddress=foobar@lab3.example.co.jp')
n.to_a
# => [["C", "JP", 19], ["ST... -
ENV
. to _ a -> [[String , String]] (37213.0) -
環境変数から [変数名, 値] となる 2 要素の配列の配列を生成します。
環境変数から [変数名, 値] となる 2 要素の配列の配列を生成します。 -
OpenSSL
:: X509 :: Extension # to _ a -> [String , String , bool] (37213.0) -
拡張領域の内容を、[識別子(extnID), 値(extnValue), 重要度(critical)] という 形で返します。
拡張領域の内容を、[識別子(extnID), 値(extnValue), 重要度(critical)] という
形で返します。 -
Object
# psych _ to _ yaml(options = {}) -> String (36985.0) -
オブジェクトを YAML document に変換します。
オブジェクトを YAML document に変換します。
options でオプションを指定できます。
Psych.dump と同じなので詳しくはそちらを参照してください。
syck に to_yaml メソッドがあるため、
psych_to_yaml が別名として定義されています。将来的に
syck が廃止された場合 psych_to_yaml は廃止
される予定であるため、特別の事情がない限り to_yaml を用いてください。
@param options 出力オプション
@see Psych.dump -
Object
# to _ yaml(options = {}) -> String (36985.0) -
オブジェクトを YAML document に変換します。
オブジェクトを YAML document に変換します。
options でオプションを指定できます。
Psych.dump と同じなので詳しくはそちらを参照してください。
syck に to_yaml メソッドがあるため、
psych_to_yaml が別名として定義されています。将来的に
syck が廃止された場合 psych_to_yaml は廃止
される予定であるため、特別の事情がない限り to_yaml を用いてください。
@param options 出力オプション
@see Psych.dump -
SDBM
# to _ a -> [[String]] (36982.0) -
self の各要素を格納した配列を返します。
self の各要素を格納した配列を返します。
返される配列の1つの要素は [key, value] です。
つまり配列の配列を返します。
require 'sdbm'
db1 = SDBM.open('aaa.gdbm', 0666)
db1.clear
db1['a'] = 'aaa'
db1['b'] = 'bbb'
db1['c'] = 'ccc'
p db1.to_a #=> [["a", "aaa"], ["b", "bbb"], ["c", "ccc"]] -
CGI
:: HtmlExtension # image _ button(attributes) -> String (36949.0) -
タイプが image の input 要素を生成します。
タイプが image の input 要素を生成します。
@param attributes 属性をハッシュで指定します。
例:
image_button({ "SRC" => "url", "ALT" => "string" })
# <INPUT TYPE="image" SRC="url" ALT="string"> -
CGI
:: HtmlExtension # image _ button(src = "" , name = nil , alt = nil) -> String (36949.0) -
タイプが image の input 要素を生成します。
タイプが image の input 要素を生成します。
@param src src 属性の値を指定します。
@param name name 属性の値を指定します。
@param alt alt 属性の値を指定します。
例:
image_button("url")
# <INPUT TYPE="image" SRC="url">
image_button("url", "name", "string")
# <INPUT TYPE="image" SRC="url" NAME="name" ALT="string"> -
OptionParser
# to _ a -> [String] (36946.0) -
サマリの各行を要素とした配列を返します。
サマリの各行を要素とした配列を返します。
//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.to_a # => ["Usage: test [options]", " -i, --init\n", " -u, --update\n", " -h, --help\n"]
//} -
Shell
:: Filter # to _ a -> [String] (36946.0) -
実行結果を文字列の配列で返します。
実行結果を文字列の配列で返します。
require 'shell'
Shell.def_system_command("wc")
sh = Shell.new
puts sh.cat("/etc/passwd").to_a -
Kconv
. # tolocale(str) -> String (36940.0) -
文字列 str のエンコーディングをロケールエンコーディングに変換して返します。
文字列 str のエンコーディングをロケールエンコーディングに変換して返します。
ロケールエンコーディングについては Encoding.locale_charmap を見てください。
このメソッドは MIME エンコードされた文字列を展開し、
いわゆる半角カナを全角に変換します。
これらを変換したくない場合は、 String#encode
を使ってください。
Kconv.kconv(str, Encoding.locale_charmap)と同じです。
@param str 変換元の文字列
@see String#tolocale -
Object
# singleton _ class -> Class (36937.0) -
レシーバの特異クラスを返します。 まだ特異クラスがなければ、新しく作成します。
レシーバの特異クラスを返します。
まだ特異クラスがなければ、新しく作成します。
レシーバが nil か true か false なら、それぞれ NilClass, TrueClass,
FalseClass を返します。
@raise TypeError レシーバが Integer、Float、Symbol の場合に発生します。
//emlist[][ruby]{
Object.new.singleton_class #=> #<Class:#<Object:0xb7ce1e24>>
String.singleton_class #=> #<Class:String>
n... -
Addrinfo
# to _ sockaddr -> String (36931.0) -
struct sockaddr をパックした形式の文字列に変換します。
struct sockaddr をパックした形式の文字列に変換します。
require 'socket'
Addrinfo.tcp("localhost", 80).to_sockaddr
#=> "\x02\x00\x00P\x7F\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00" -
Kernel
. # autoload?(const _ name) -> String | nil (36922.0) -
const_name が Kernel.#autoload 設定されているか調べます。
const_name が Kernel.#autoload 設定されているか調べます。
autoload 設定されていて、autoload 定数がまだ定義されてない(ロードされていない)
ときにそのパス名を返します。
autoload 設定されていないか、ロード済みなら nil を返します。
@param const_name 定数をString または Symbol で指定します。
//emlist[例][ruby]{
# ------- /tmp/foo.rb ---------
class Foo
class Bar
end
end
# ----- end of /tm... -
Module
# autoload?(const _ name) -> String | nil (36922.0) -
autoload 定数がまだ定義されてない(ロードされていない) ときにそのパス名を返します。 また、ロード済みなら nil を返します。
autoload 定数がまだ定義されてない(ロードされていない) ときにそのパス名を返します。
また、ロード済みなら nil を返します。
@param const_name String または Symbol で指定します。
@see Kernel.#autoload?
//emlist[例][ruby]{
autoload :Date, 'date'
autoload?(:Date) # => "date"
Date
autoload?(:Date) # => nil
autoload?(:Foo) # => nil
//} -
GDBM
# to _ a -> [[String]] (36910.0) -
self の各要素を格納した配列を返します。
self の各要素を格納した配列を返します。
返される配列の1つの要素は [key, value] です。
つまり配列の配列を返します。 -
Psych
:: Nodes :: Node # to _ yaml(io=nil , options={}) -> String | IO (36910.0) -
AST を YAML ドキュメントに変換します。
AST を YAML ドキュメントに変換します。
io に IO オブジェクトを指定した場合は、その
オブジェクトに変換後のドキュメントが書き込まれます。
この場合は io を返り値として返します。
io を省略した(nil を指定した)場合には変換後のドキュメントを
文字列で返します。
Psych::Nodes::Stream 以外を変換しようとすると、AST として不正で
あるためエラーが発生します。
options には以下が指定できます。
: :version
YAML document に付加するバージョンを [major, minor] という配列、
もしくは文... -
YAML
:: DBM # to _ a -> [[String , object]] (36910.0) -
キーと値のペアを配列に変換して返します。
キーと値のペアを配列に変換して返します。 -
CGI
:: HtmlExtension # radio _ button(attributes) -> String (36907.0) -
タイプが radio である input 要素を生成します。
タイプが radio である input 要素を生成します。
@param attributes 属性をハッシュで指定します。
例:
radio_button({ "NAME" => "name", "VALUE" => "value", "ID" => "foo" })
# <INPUT TYPE="radio" NAME="name" VALUE="value" ID="foo"> -
CGI
:: HtmlExtension # radio _ button(name = "" , value = nil , checked = nil) -> String (36907.0) -
タイプが radio である input 要素を生成します。
タイプが radio である input 要素を生成します。
@param name name 属性の値を指定します。
@param value value 属性の値を指定します。
@param checked 真ならば checked 属性を設定します。
例:
radio_button("name", "value")
# <INPUT TYPE="radio" NAME="name" VALUE="value">
radio_button("name", "value", true)
# <INPUT TYPE="radio" NAME="name" ... -
Kernel
$ $ FIELD _ SEPARATOR -> String | nil (36907.0) -
$; の別名
$; の別名
require "English"
str = "hoge,fuga,ugo,bar,foo"
p str.split #=> ["hoge,fuga,ugo,bar,foo"]
$FIELD_SEPARATOR = ","
p str.split #=> ["hoge", "fuga", "ugo", "bar", "foo"] -
Kernel
$ $ INPUT _ RECORD _ SEPARATOR -> String | nil (36907.0) -
$/ の別名
$/ の別名
require "English"
$INPUT_RECORD_SEPARATOR = '|'
array = []
while line = DATA.gets
array << line
end
p array #=> ["ugo|", "ego|", "fogo\n"]
__END__
ugo|ego|fogo -
Gem
:: SourceIndex . installed _ spec _ directories -> [String] (36904.0) -
gemspec ファイルがインストールされているディレクトリのリストを返します。
gemspec ファイルがインストールされているディレクトリのリストを返します。
@see Gem.#path -
Gem
:: Specification # autorequire -> String (36904.0) -
非推奨の属性です。
非推奨の属性です。 -
Shell
# record _ separator -> String (36904.0) -
@todo
@todo -
Shell
. default _ record _ separator -> String (36904.0) -
執筆者募集
執筆者募集
Shell で用いられる入力レコードセパレータを表す文字列を設定および参照します。
なにも指定しない場合は$/ の値が用いられます。
@param rs Shell で用いられる入力レコードセパレータを表す文字列を指定します。 -
MACRO SafeStringValue(v) (36745.0)
-
StringValue と同じく、val が String でなければ to_str メソッドを 使って String に変換します。同時に rb_check_safe_str() によるチェックも 行います。
StringValue と同じく、val が String でなければ to_str メソッドを
使って String に変換します。同時に rb_check_safe_str() によるチェックも
行います。 -
char * StringValuePtr(VALUE val) (36745.0)
-
val が String でなければ to_str メソッドを使って String に変換し、 その実体のポインタを返します。
val が String でなければ to_str メソッドを使って String に変換し、
その実体のポインタを返します。
このマクロに渡した VALUE は ruby の GC から確実に保護されます。 -
MatchData
# values _ at(*index) -> [String] (36712.0) -
正規表現中の n 番目の括弧にマッチした部分文字列の配列を返します。
正規表現中の n 番目の括弧にマッチした部分文字列の配列を返します。
0 番目は $& のようにマッチした文字列全体を表します。
@param index インデックスを整数またはシンボル(名前付きキャプチャの場合)で 0 個以上指定します。
//emlist[例][ruby]{
m = /(foo)(bar)(baz)/.match("foobarbaz")
# same as m.to_a.values_at(...)
p m.values_at(0, 1, 2, 3, 4) # => ["foobarbaz", "foo", "bar", "baz", nil]
p m... -
MatchData
# to _ s -> String (36625.0) -
マッチした文字列全体を返します。
マッチした文字列全体を返します。
//emlist[例][ruby]{
/bar/ =~ "foobarbaz"
p $~ # => #<MatchData:0x401b1be4>
p $~.to_s # => "bar"
//} -
Kernel
. # autoload(const _ name , feature) -> nil (36619.0) -
定数 const_name を最初に参照した時に feature を Kernel.#require するように設定します。
定数 const_name を最初に参照した時に feature を
Kernel.#require するように設定します。
const_name には、 "::" 演算子を含めることはできません。
ネストした定数を指定する方法は Module#autoload を参照してください。
const_name が autoload 設定されていて、まだ定義されてない(ロードされていない)ときは、
autoload する対象を置き換えます。
const_name が(autoloadではなく)既に定義されているときは何もしません。
@param const_name 定数をString また... -
Module
# autoload(const _ name , feature) -> nil (36619.0) -
定数 const_name を最初に参照した時に feature を Kernel.#require するように設定します。
定数 const_name を最初に参照した時に feature を Kernel.#require するように設定します。
const_name が autoload 設定されていて、まだ定義されてない(ロードされていない)ときは、
autoload する対象を置き換えます。
const_name が(autoloadではなく)既に定義されているときは何もしません。
@param const_name String または Symbol で指定します。
なお、const_name には、"::" 演算子を含めることはできません。
つまり、self の直下に定... -
OpenSSL
:: ASN1 :: ASN1Data # to _ der -> String (36607.0) -
ASN.1 値の DER 表現を返します。
ASN.1 値の DER 表現を返します。
@see OpenSSL::ASN1.#decode -
Shell
. default _ record _ separator=(rs) (36604.0) -
執筆者募集
執筆者募集
Shell で用いられる入力レコードセパレータを表す文字列を設定および参照します。
なにも指定しない場合は$/ の値が用いられます。
@param rs Shell で用いられる入力レコードセパレータを表す文字列を指定します。 -
WEBrick
:: HTTPAuth :: Authenticator # realm -> String (36604.0) -
レルムを返します。
レルムを返します。 -
Scanf
:: FormatString # to _ s (36304.0) -
@todo
@todo -
Enumerator (36109.0)
-
each 以外のメソッドにも Enumerable の機能を提供するためのラッパークラスです。 また、外部イテレータとしても使えます。
each 以外のメソッドにも Enumerable の機能を提供するためのラッパークラスです。
また、外部イテレータとしても使えます。
Enumerable モジュールは、 Module#include 先のクラスが持つ
each メソッドを元に様々なメソッドを提供します。
例えば Array#map は Array#each の繰り返しを元にして定義されます。
Enumerator を介することにより String#each_byte のような
異なる名前のイテレータについても each と同様に Enumerable の機能を利用できます。
Enumerator を生成するには Enu... -
rubygems
/ commands / search _ command (36109.0) -
指定された文字列を含む Gem パッケージを全て表示するためのライブラリです。
指定された文字列を含む Gem パッケージを全て表示するためのライブラリです。
Usage: gem search [STRING] [options]
Options:
-i, --[no-]installed Check for installed gem
-v, --version VERSION Specify version of gem to search
-d, --[no-]details Display detailed information of g... -
rubygems
/ commands / list _ command (36073.0) -
Gem パッケージの名前を前方一致で検索するためのライブラリです。
Gem パッケージの名前を前方一致で検索するためのライブラリです。
Usage: gem list [STRING] [options]
Options:
-i, --[no-]installed Check for installed gem
-v, --version VERSION 指定されたバージョンの一覧を出力します
-d, --[no-]details Gem パッケージの詳細も表示します
--[no-]versions ... -
rdoc
/ markup / to _ ansi (36037.0) -
RDoc 形式のドキュメントを ANSI エスケープシーケンスで色付けするサブライ ブラリです。
RDoc 形式のドキュメントを ANSI エスケープシーケンスで色付けするサブライ
ブラリです。
require 'rdoc/markup/to_ansi'
h = RDoc::Markup::ToAnsi.new
puts h.convert(input_string)
変換した結果は文字列で取得できます。 -
rdoc
/ markup / to _ bs (36037.0) -
RDoc 形式のドキュメントをエスケープシーケンスで太字やアンダーラインの効 果を持たせるように見せるサブライブラリです。
RDoc 形式のドキュメントをエスケープシーケンスで太字やアンダーラインの効
果を持たせるように見せるサブライブラリです。
require 'rdoc/markup/to_bs'
h = RDoc::Markup::ToBs.new
puts h.convert(input_string)
変換した結果は文字列で取得できます。実際に効果を確認するためにはページャ
などで出力を確認します。
テキスト中の以下のマークアップ記法をエスケープシーケンスの \b と組み合
わせる事によって見た目を変更します。
* イタリック体(_word_): word にアンダーラインを付けて... -
rdoc
/ markup / to _ html (36037.0) -
RDoc 形式のドキュメントを HTML に整形するためのサブライブラリです。
RDoc 形式のドキュメントを HTML に整形するためのサブライブラリです。
require 'rdoc/markup/to_html'
h = RDoc::Markup::ToHtml.new
puts h.convert(input_string)
変換した結果は文字列で取得できます。 -
OpenSSL
:: X509 :: Name # to _ s(flags=nil) -> String (27997.0) -
DNの文字列表現を返します。
DNの文字列表現を返します。
flags には通常は以下のいずれかを渡します。
* nil
* OpenSSL::X509::Name::COMPAT
* OpenSSL::X509::Name::RFC2253
* OpenSSL::X509::Name::ONELINE
* OpenSSL::X509::Name::MULTILINE
*
例:
require 'openssl'
n = OpenSSL::X509::Name.parse('/C=JP/ST=Kanagawa/L=Yokohama/O=Example Company/OU=Lab3/CN... -
Range
# to _ json(*args) -> String (27997.0) -
自身を JSON 形式の文字列に変換して返します。
自身を JSON 形式の文字列に変換して返します。
内部的にはハッシュにデータをセットしてから JSON::Generator::GeneratorMethods::Hash#to_json を呼び出しています。
@param args 引数はそのまま JSON::Generator::GeneratorMethods::Hash#to_json に渡されます。
//emlist[例][ruby]{
require "json/add/core"
(1..5).to_json # => "{\"json_class\":\"Range\",\"a\":[1,5,false]}"
//...