別のキーワード
ライブラリ
- English (8)
- ビルトイン (29)
- benchmark (1)
- bigdecimal (16)
-
bigdecimal
/ ludcmp (1) -
bigdecimal
/ util (4) - coverage (1)
- csv (27)
- date (3)
- dbm (3)
- delegate (1)
- digest (4)
- erb (4)
- fiddle (13)
-
fiddle
/ import (3) - fileutils (2)
- find (1)
- forwardable (2)
- getoptlong (6)
- ipaddr (6)
-
irb
/ inspector (2) - json (22)
-
json
/ add / bigdecimal (1) -
json
/ add / complex (1) -
json
/ add / date (1) -
json
/ add / date _ time (1) -
json
/ add / exception (1) -
json
/ add / range (1) -
json
/ add / rational (1) -
json
/ add / regexp (1) -
json
/ add / struct (1) -
json
/ add / time (1) - logger (1)
- matrix (60)
- mkmf (1)
- monitor (8)
-
net
/ http (6) -
net
/ smtp (9) - observer (1)
- openssl (28)
- optparse (21)
- ostruct (5)
- pathname (29)
- prime (11)
- pstore (6)
- rake (3)
-
rdoc
/ context (1) -
rdoc
/ markup (4) -
rdoc
/ markup / formatter (1) - readline (14)
-
rexml
/ document (25) -
ripper
/ lexer (1) -
rubygems
/ requirement (1) -
rubygems
/ specification (2) - sdbm (4)
- securerandom (1)
- singleton (1)
- socket (14)
- stringio (4)
- syslog (1)
- tsort (6)
- uri (18)
-
webrick
/ httpresponse (7) -
webrick
/ httpstatus (3) -
webrick
/ httputils (2) -
webrick
/ httpversion (1) -
webrick
/ log (2) - zlib (6)
クラス
- Addrinfo (5)
- Array (7)
- BasicSocket (1)
- BigDecimal (17)
- CSV (11)
-
CSV
:: FieldInfo (1) -
CSV
:: Row (5) -
CSV
:: Table (8) - Complex (1)
- Coverage (1)
- DBM (3)
- Date (2)
- DateTime (3)
-
Digest
:: Base (3) - ERB (3)
- Enumerator (3)
- Exception (1)
-
Fiddle
:: Pointer (11) - File (1)
- Float (2)
-
Gem
:: Requirement (1) -
Gem
:: Specification (2) - GetoptLong (6)
- IPAddr (6)
-
IRB
:: Inspector (1) - Integer (2)
-
JSON
:: State (2) - Logger (1)
- Matrix (28)
-
Matrix
:: LUPDecomposition (1) - Module (1)
- Monitor (5)
-
Net
:: HTTPGenericRequest (2) -
Net
:: HTTPResponse (4) -
Net
:: SMTP (9) - NilClass (1)
- Object (5)
-
OpenSSL
:: BN (13) -
OpenSSL
:: X509 :: ExtensionFactory (1) -
OpenSSL
:: X509 :: Name (5) -
OpenSSL
:: X509 :: StoreContext (1) - OpenStruct (5)
- OptionParser (20)
- PStore (5)
- Pathname (29)
- Prime (3)
-
Prime
:: EratosthenesGenerator (3) -
Prime
:: PseudoPrimeGenerator (4) -
RDoc
:: Context (1) -
RDoc
:: Markup (3) -
RDoc
:: Markup :: Formatter (1) -
REXML
:: Attribute (1) -
REXML
:: Attributes (1) -
REXML
:: CData (3) -
REXML
:: Child (2) -
REXML
:: Element (6) -
REXML
:: Elements (6) -
REXML
:: Text (4) -
Rake
:: DefaultLoader (1) - Random (3)
- Range (4)
- Rational (2)
- Regexp (1)
- Ripper (1)
-
RubyVM
:: InstructionSequence (1) - SDBM (4)
- Socket (4)
- String (1)
- StringIO (4)
- Struct (1)
- Thread (1)
- Time (1)
- UNIXSocket (3)
-
URI
:: FTP (2) -
URI
:: Generic (8) -
URI
:: LDAP (2) -
URI
:: MailTo (6) - Vector (31)
-
WEBrick
:: BasicLog (2) -
WEBrick
:: HTTPResponse (7) -
WEBrick
:: HTTPUtils :: FormData (2) -
WEBrick
:: HTTPVersion (1) -
Zlib
:: GzipReader (3) -
Zlib
:: GzipWriter (3)
モジュール
- Benchmark (1)
-
ERB
:: DefMethod (1) - Enumerable (3)
-
Fiddle
:: Importer (3) - FileUtils (2)
- Find (1)
- Forwardable (2)
- IRB (1)
- JSON (9)
-
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 (2) -
JSON
:: Generator :: GeneratorMethods :: String :: Extend (1) -
JSON
:: Generator :: GeneratorMethods :: TrueClass (1) - Kernel (10)
- LUSolve (1)
- MonitorMixin (1)
-
OpenSSL
:: ASN1 (1) -
OptionParser
:: Arguable (1) - Rake (2)
- Readline (1)
-
Syslog
:: Macros (1) - TSort (6)
-
WEBrick
:: HTTPStatus (3)
オブジェクト
-
Readline
:: HISTORY (12)
キーワード
-
$ CHILD _ STATUS (1) -
$ ERROR _ INFO (1) -
$ FIELD _ SEPARATOR (1) -
$ FS (1) -
$ INPUT _ RECORD _ SEPARATOR (1) -
$ OUTPUT _ FIELD _ SEPARATOR (1) -
$ OUTPUT _ RECORD _ SEPARATOR (1) -
$ RS (1) - % (1)
- * (2)
- +@ (1)
- -@ (1)
- << (6)
- >> (1)
-
ARGUMENT
_ FLAGS (1) - ASN1 (1)
- Base (1)
- BlockCaller (1)
-
CODE
_ CLASS _ TO _ OBJ (1) -
CODE
_ TO _ OBJ (1) - CSV (1)
- Closure (1)
- DATA (1)
- ExtensionFactory (1)
- ExternalEntity (1)
- Inspector (1)
-
LOG
_ UPTO (1) - Markup (1)
- Monitor (1)
- MonitorMixin (1)
-
NEWS for Ruby 2
. 5 . 0 (1) -
NEWS for Ruby 2
. 6 . 0 (1) -
NEWS for Ruby 2
. 7 . 0 (1) - NotationDecl (1)
- OCSP (1)
- ORDERINGS (1)
- Observable (1)
- PStore (1)
-
RC
_ REQUEST _ ENTITY _ TOO _ LARGE (1) -
RC
_ REQUEST _ URI _ TOO _ LARGE (1) -
RC
_ SWITCHING _ PROTOCOLS (1) -
REQUIRED
_ ARGUMENT (1) -
REQUIRE
_ ORDER (1) - RSA (1)
- Readline (1)
- Request (1)
- Ruby用語集 (1)
- SSLSocket (1)
- SecureRandom (1)
- SimpleDelegator (1)
- Singleton (1)
- TCPServer (1)
- [] (5)
- []= (6)
- abort (1)
- abs (1)
- absolute? (1)
- add (1)
-
add
_ element (1) -
add
_ html (1) -
add
_ namespace (2) -
add
_ special (1) -
add
_ tag (1) -
add
_ to (1) -
add
_ word _ pair (1) -
angle
_ with (1) - application (1)
- application= (1)
- ascend (2)
- atime (1)
- autoload (2)
- autorequire (1)
- autorequire= (1)
- basename (1)
- basis (1)
- bigdecimal (1)
-
bigdecimal
/ math (1) -
bigdecimal
/ newton (1) -
bigdecimal
/ util (1) - bind (1)
- binread (1)
- body= (1)
-
body
_ stream (1) -
body
_ stream= (1) - build (4)
- ceil (2)
- children (1)
- chown (1)
- chunked= (1)
- coerce (1)
-
cofactor
_ expansion (1) -
col
_ sep (1) - collect (3)
- collect! (3)
- collect2 (2)
- column (1)
-
column
_ vectors (1) - combine (1)
- commit (1)
- component (1)
- config= (1)
-
content
_ length (1) -
content
_ length= (1) - covector (1)
-
create
_ id (1) -
create
_ id= (1) -
create
_ makefile (1) - ctime (1)
- decode (1)
-
def
_ delegator (1) -
def
_ erb _ method (1) -
def
_ inspector (1) -
def
_ instance _ delegator (1) - delete (4)
-
delete
_ all (1) -
delete
_ at (1) -
delete
_ element (1) -
delete
_ if (2) -
delete
_ namespace (1) - descend (2)
- dirname (1)
- each (8)
-
each
_ byte (2) -
each
_ child (2) -
each
_ entry (2) -
each
_ line (4) -
each
_ pair (2) -
each
_ strongly _ connected _ component (2) -
each
_ strongly _ connected _ component _ from (2) -
each
_ with _ index (4) - eigen (1)
- eigensystem (1)
- elements (1)
-
elements
_ to _ f (1) -
elements
_ to _ i (1) -
elements
_ to _ r (1) - empty? (2)
- enter (1)
- entries (2)
- error= (1)
- exit (1)
- fatal (1)
- fetch (1)
- fiddle (1)
-
fiddle
/ import (1) - file (1)
- find (3)
-
find
_ index (3) - floor (2)
- fnmatch (1)
- foreach (1)
- formatter (1)
- generate (1)
- getaddrinfo (2)
- getoptlong (1)
- getopts (1)
- getservbyport (1)
-
handle
_ interrupt (1) -
header
_ convert (3) -
header
_ converters (1) - headers (1)
- headers= (1)
- help (1)
- hexdigest (1)
- hostname= (1)
-
http
_ version (1) - independent? (1)
- index (3)
-
ipv6
_ to _ ipv4 (1) - irb (1)
-
irb
/ completion (1) -
json
/ add / core (1) -
json
_ create (1) -
laplace
_ expansion (1) - length (1)
- line (1)
- list (1)
- load (2)
- logger (1)
- lshift! (1)
- lup (1)
-
lup
_ decomposition (1) - lusolve (1)
- magnitude (1)
- map (3)
- map! (3)
- map2 (1)
-
mask
_ bits! (1) - measure (1)
- merge! (1)
-
minitest
/ autorun (1) - minor (2)
-
mod
_ inverse (1) - modulo (1)
-
mon
_ enter (2) -
mon
_ exit (1) - negative? (1)
-
net
/ http (1) -
net
/ smtp (1) - new (15)
-
new
_ ntoh (1) - next (1)
-
next
_ sibling= (1) - norm (1)
- normalize (2)
- normalize! (1)
-
num
_ bytes (1) - open (5)
- openssl (1)
-
optparse
/ date (1) - order (4)
- order! (2)
- ordering= (1)
- pack (2)
- pack テンプレート文字列 (1)
- pair (1)
- parse (3)
- parse! (1)
- path (1)
- permute (2)
- permute! (1)
- pop (1)
-
pretty
_ generate (1) -
pretty
_ print (1) -
pretty
_ unparse (1) -
previous
_ sibling= (1) -
prime
_ division (2) - produce (1)
-
program
_ name (1) -
program
_ name= (1) - protocol (1)
- psych (1)
- ptr (1)
- push (1)
- putc (1)
- r (1)
- rake (1)
- rand (3)
- rdoc (1)
-
rdoc
/ markup / to _ ansi (1) -
rdoc
/ markup / to _ bs (1) -
rdoc
/ markup / to _ html (1) -
read
_ body (2) - readline (1)
- ready (1)
- ref (1)
-
relative
_ path _ from (1) - remainder (1)
- replace (1)
- resolv (1)
- restore (1)
- result (2)
- rewind (1)
-
rexml
/ parsers / sax2parser (1) -
rexml
/ parsers / streamparser (1) - round (3)
-
route
_ to (1) - row (1)
-
row
_ vectors (1) - rshift! (1)
- rss (1)
-
ruby 1
. 6 feature (1) -
ruby 1
. 8 . 4 feature (1) -
ruby 1
. 9 feature (1) - rubygems (1)
-
rubygems
/ commands / lock _ command (1) -
rubygems
/ custom _ require (1) - run (1)
- sample (4)
-
send
_ io (1) -
send
_ mail (1) - sendmail (1)
- separator (1)
- setsockopt (1)
- shift (1)
- size (1)
- sizeof (1)
- socketpair (1)
- solve (1)
- split (2)
- src (1)
- start (4)
- state (1)
- store (1)
- strptime (1)
- struct (1)
- succ (2)
- summarize (2)
- text= (1)
- then (2)
- to= (1)
-
to
_ a (12) -
to
_ ary (1) -
to
_ bn (1) -
to
_ csv (3) -
to
_ d (4) -
to
_ h (3) -
to
_ hash (4) -
to
_ i (1) -
to
_ json (19) -
to
_ json _ raw _ object (1) -
to
_ mailtext (1) -
to
_ ptr (1) -
to
_ range (1) -
to
_ rfc822text (1) -
to
_ s (20) -
to
_ sockaddr (1) -
to
_ string (2) -
to
_ value (1) - today (1)
- tokenize (1)
- touch (1)
- tracer (1)
- transaction (1)
- truncate (2)
- tsort (1)
-
tsort
_ each (2) - unlink (1)
- unpack (1)
- unparse (1)
- update (1)
- uptodate? (1)
- userinfo= (1)
- value (2)
- value= (1)
-
wait
_ for _ cond (1) -
with
_ index (4) - write (2)
-
yaml
/ store (1) -
yield
_ self (2) - zero (1)
- 制御構造 (1)
検索結果
先頭5件
-
URI
:: MailTo # to -> String (63340.0) -
自身の e-mail アドレスを文字列で返します。
自身の e-mail アドレスを文字列で返します。
例:
require 'uri'
p URI.parse("mailto:nospam@example.com").to #=> "nospam@example.com" -
Gem
:: Specification # autorequire -> String (36601.0) -
非推奨の属性です。
非推奨の属性です。 -
Gem
:: Specification # autorequire=(lib) (36601.0) -
非推奨の属性です。
非推奨の属性です。 -
JSON
:: Generator :: GeneratorMethods :: Object # to _ json(state _ or _ hash = nil) -> String (36424.0) -
自身を to_s で文字列にした結果を JSON 形式の文字列に変換して返します。
自身を to_s で文字列にした結果を JSON 形式の文字列に変換して返します。
このメソッドはあるオブジェクトに to_json メソッドが定義されていない場合に使用する
フォールバックのためのメソッドです。
@param state_or_hash 生成する JSON 形式の文字列をカスタマイズするため
に JSON::State のインスタンスか、
JSON::State.new の引数と同じ Hash を
指定します。
//emlist[例][ruby... -
JSON
:: Generator :: GeneratorMethods :: String # to _ json(state _ or _ hash = nil) -> String (36394.0) -
自身から生成した JSON 形式の文字列を返します。
自身から生成した JSON 形式の文字列を返します。
自身のエンコードは UTF-8 であるべきです。
"\u????" のように UTF-16 ビッグエンディアンでエンコードされた文字列を返すことがあります。
@param state_or_hash 生成する JSON 形式の文字列をカスタマイズするため
に JSON::State のインスタンスか、
JSON::State.new の引数と同じ Hash を
指定します。
//emlist[例][ruby]... -
JSON
:: Generator :: GeneratorMethods :: String # to _ json _ raw _ object -> Hash (36358.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::... -
JSON
:: Generator :: GeneratorMethods :: Array # to _ json(state _ or _ hash = nil) -> String (36340.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 (36340.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 :: Float # to _ json(state _ or _ hash = nil) -> String (36340.0) -
自身から生成した JSON 形式の文字列を返します。
自身から生成した JSON 形式の文字列を返します。
@param state_or_hash 生成する JSON 形式の文字列をカスタマイズするため
に JSON::State のインスタンスか、
JSON::State.new の引数と同じ Hash を
指定します。
//emlist[例][ruby]{
require "json"
(1.0).to_json # => "1.0"
//} -
JSON
:: Generator :: GeneratorMethods :: Hash # to _ json(state _ or _ hash = nil) -> String (36340.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 (36340.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 (36340.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 (36340.0) -
自身から生成した JSON 形式の文字列を返します。
自身から生成した JSON 形式の文字列を返します。
"true" という文字列を返します。
@param state_or_hash 生成する JSON 形式の文字列をカスタマイズするため
に JSON::State のインスタンスか、
JSON::State.new の引数と同じ Hash を
指定します。
//emlist[例][ruby]{
require "json"
true.to_json # => "true"
//} -
rubygems
/ custom _ require (36049.0) -
Kernel#require を再定義するためのライブラリです。
Kernel#require を再定義するためのライブラリです。
Ruby1.9 以前で使用しています。 -
Vector
# elements _ to _ f -> Vector (27658.0) -
ベクトルの各成分をFloatに変換したベクトルを返します。
ベクトルの各成分をFloatに変換したベクトルを返します。
このメソッドは deprecated です。 map(&:to_f) を使ってください。
//emlist[例][ruby]{
require 'matrix'
v = Vector.elements([2, 3, 5, 7, 9])
p v.elements_to_f
# => Vector[2.0, 3.0, 5.0, 7.0, 9.0]
//} -
Vector
# elements _ to _ i -> Vector (27658.0) -
ベクトルの各成分をIntegerに変換したベクトルを返します。
ベクトルの各成分をIntegerに変換したベクトルを返します。
このメソッドは deprecated です。 map(&:to_i) を使ってください。
//emlist[例][ruby]{
require 'matrix'
v = Vector.elements([2.5, 3.0, 5.01, 7])
p v.elements_to_i
# => Vector[2, 3, 5, 7]
//} -
Vector
# elements _ to _ r -> Vector (27658.0) -
ベクトルの各成分をRationalに変換したベクトルを返します。
ベクトルの各成分をRationalに変換したベクトルを返します。
このメソッドは deprecated です。 map(&:to_r) を使ってください。
//emlist[例][ruby]{
require 'matrix'
v = Vector.elements([2.5, 3.0, 5.75, 7])
p v.elements_to_r
# => Vector[(5/2), (3/1), (23/4), (7/1)]
//} -
Readline
:: HISTORY . to _ s -> "HISTORY" (27640.0) -
文字列"HISTORY"を返します。
文字列"HISTORY"を返します。
例:
require 'readline'
Readline::HISTORY.to_s #=> "HISTORY" -
URI
:: MailTo # to _ mailtext -> String (27361.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... -
URI
:: MailTo # to _ rfc822text -> String (27361.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... -
IRB
:: Inspector . def _ inspector(key , arg = nil) { |v| . . . } -> object (27355.0) -
新しい実行結果の出力方式を定義します。
新しい実行結果の出力方式を定義します。
@param key conf.inspect_mode や IRB.conf[:INSPECT_MODE] に指定するキー
オブジェクトを指定します。配列を指定した場合は配列中の要素全
てが対象になります。
@param arg ブロックを指定する場合には、inspect_mode の初期化のための手続
きオブジェクトを指定します。あらかじめ require が必要な場合
などに、proc { require "foo" } といった指定を行います。
... -
URI
:: MailTo # to=(s) (27340.0) -
自身の e-mail アドレスを文字列で設定します。
自身の e-mail アドレスを文字列で設定します。
@param s 自身の e-mail アドレスを文字列で指定します。
@raise URI::InvalidComponentError 不正な引数 s に対して発生します。
例:
require 'uri'
m = URI.parse("mailto:nospam@example.com")
m.to = "nospaaaam@example.com"
p m #=> #<URI::MailTo:0xb7bf0614 URL:mailt... -
Vector
# to _ a -> Array (27340.0) -
ベクトル(Vector)から配列 (Array) に変換します。
ベクトル(Vector)から配列 (Array) に変換します。
//emlist[例][ruby]{
require 'matrix'
v = Vector[2, 3, 5, 7, 9]
p v.to_a
# => [2, 3, 5, 7, 9]
//} -
Vector
# to _ s -> String (27340.0) -
ベクトル(Vector)から文字列 (String) に変換します。
ベクトル(Vector)から文字列 (String) に変換します。
//emlist[例][ruby]{
require 'matrix'
v = Vector[2, 3, 5, 7, 9]
p v.to_s
# => "Vector[2, 3, 5, 7, 9]"
//} -
Gem
:: Requirement # to _ s -> String (27322.0) -
条件を表す文字列を返します。
条件を表す文字列を返します。
//emlist[][ruby]{
req = Gem::Requirement.new(["< 5.0", ">= 1.9"])
p req.to_s # => "< 5.0, >= 1.9"
//} -
Vector
# covector -> Matrix (27319.0) -
Matrix オブジェクトへ変換します。
Matrix オブジェクトへ変換します。
列ベクトル (行列)、すなわち、(n, 1) 型の行列に変換します。
実際には Matrix.row_vector(self) を適用します。
//emlist[例][ruby]{
require 'matrix'
v = Vector[2, 3, 5]
p v # => Vector[2, 3, 5]
m = v.covector
p m # => Matrix[[2, 3, 5]]
//} -
GetoptLong
:: REQUIRE _ ORDER -> 0 (27304.0) -
非オプション引数の後に来たオプションは、オプションとして認識しません。 最初に非オプション引数が現れた時点で、オプションの解析処理を中止します。
非オプション引数の後に来たオプションは、オプションとして認識しません。
最初に非オプション引数が現れた時点で、オプションの解析処理を中止します。 -
GetoptLong
:: REQUIRED _ ARGUMENT -> 1 (27301.0) -
オプションに必須引数があることを表す定数です。
オプションに必須引数があることを表す定数です。 -
OpenSSL
:: BN # to _ s(base=10) -> String (18826.0) -
自身を表す文字列を返します。
自身を表す文字列を返します。
base で、変換方法(基数)を指定します。
デフォルトは 10 で、他に 16, 2, 0 を指定できます。
10 10進数の表記
16 16進数の表記
2 big-endianの符号無し整数のバイナリ列
0 MPI形式の文字列(バイト列)
@param base 文字列への変換方法(基数)
@raise OpenSSL::BNError 変換に失敗した場合に発生します
//emlist[][ruby]{
require 'openssl'
p 10.to_bn.to_s # => "10"
p (-5).to_bn.... -
IRB
. Inspector(inspect , init = nil) -> IRB :: Inspector (18637.0) -
IRB::Inspector オブジェクトを生成します。
IRB::Inspector オブジェクトを生成します。
@param inspect 実行結果の出力のための手続きオブジェクトを指定します。
@param init inspect_mode の初期化のための手続きオブジェクトを指定します。
あらかじめ require が必要な場合などに、proc { require "foo" }
といった指定を行います。 -
Matrix
# column _ vectors -> [Vector] (18619.0) -
自分自身を列ベクトルの配列として返します。
自分自身を列ベクトルの配列として返します。
//emlist[例][ruby]{
require 'matrix'
a1 = [ 1, 2, 3]
a2 = [10, 15, 20]
a3 = [-1, -2, 1.5]
m = Matrix[a1, a2, a3]
p m.column_vectors # => [Vector[1, 10, -1], Vector[2, 15, -2], Vector[3, 20, 1.5]]
//} -
Matrix
# row _ vectors -> [Vector] (18619.0) -
自分自身を行ベクトルの配列として返します。
自分自身を行ベクトルの配列として返します。
//emlist[例][ruby]{
require 'matrix'
a1 = [ 1, 2, 3]
a2 = [10, 15, 20]
a3 = [-1, -2, 1.5]
m = Matrix[a1, a2, a3]
p m.row_vectors # => [Vector[1, 2, 3], Vector[10, 15, 20], Vector[-1, -2, 1.5]]
//} -
BigDecimal
# to _ s -> String (18577.0) -
self を文字列に変換します (デフォルトは "0.xxxxxen" の形になります)。
...equire "bigdecimal"
BigDecimal("123.456").to_s("e") # => "0.123456e3"
BigDecimal("123.456").to_s("E") # => "0.123456e3"
# (大文字で指定しても出力は 'e' になる)
BigDecimal("123.456").to_s("F") # => "123.456"
BigDecimal("1234.5678").to_s("... -
BigDecimal
# to _ s(n) -> String (18577.0) -
self を文字列に変換します (デフォルトは "0.xxxxxen" の形になります)。
...equire "bigdecimal"
BigDecimal("123.456").to_s("e") # => "0.123456e3"
BigDecimal("123.456").to_s("E") # => "0.123456e3"
# (大文字で指定しても出力は 'e' になる)
BigDecimal("123.456").to_s("F") # => "123.456"
BigDecimal("1234.5678").to_s("... -
Array
# to _ csv(**options) -> String (18448.0) -
CSV.generate_line(self, options) と同様です。
CSV.generate_line(self, options) と同様です。
Array オブジェクトを 1 行の CSV 文字列に変換するためのショートカットです。
@param options CSV.generate_line と同様のオプションを指定します。
//emlist[][ruby]{
require 'csv'
p [1, 'Matz', :Ruby, Date.new(1965, 4, 14)].to_csv # => "1,Matz,Ruby,1965-04-14\n"
p [1, 'Matz',... -
Float
# to _ d -> BigDecimal (18433.0) -
自身を BigDecimal に変換します。
自身を BigDecimal に変換します。
@param prec 計算結果の精度。省略した場合は Float::DIG + 1 です。
@return BigDecimal に変換したオブジェクト
//emlist[][ruby]{
require 'bigdecimal'
require 'bigdecimal/util'
p 1.0.to_d # => 0.1e1
p (1.0 / 0).to_d # => Infinity
p (1.0 / 3).to_d / (2.0 / 3).to_d # => 0.5e0
p ((1.0 / 3) / (2.0 / 3... -
Float
# to _ d(prec) -> BigDecimal (18433.0) -
自身を BigDecimal に変換します。
自身を BigDecimal に変換します。
@param prec 計算結果の精度。省略した場合は Float::DIG + 1 です。
@return BigDecimal に変換したオブジェクト
//emlist[][ruby]{
require 'bigdecimal'
require 'bigdecimal/util'
p 1.0.to_d # => 0.1e1
p (1.0 / 0).to_d # => Infinity
p (1.0 / 3).to_d / (2.0 / 3).to_d # => 0.5e0
p ((1.0 / 3) / (2.0 / 3... -
Exception
# to _ json(*args) -> String (18430.0) -
自身を JSON 形式の文字列に変換して返します。
自身を JSON 形式の文字列に変換して返します。
内部的にはハッシュにデータをセットしてから JSON::Generator::GeneratorMethods::Hash#to_json を呼び出しています。
@param args 引数はそのまま JSON::Generator::GeneratorMethods::Hash#to_json に渡されます。
//emlist[例][ruby]{
require "json/add/core"
begin
0/0
rescue => e
e.to_json # => "{\"json_class\":\"ZeroDivis... -
Addrinfo
# ipv6 _ to _ ipv4 -> Addrinfo|nil (18412.0) -
IPv6 の v4 マップド/互換アドレスを v4 のアドレスに変換します。
IPv6 の v4 マップド/互換アドレスを v4 のアドレスに変換します。
それ以外のアドレスの場合 nil を返します。
require 'socket'
Addrinfo.ip("::192.0.2.3").ipv6_to_ipv4 #=> #<Addrinfo: 192.0.2.3>
Addrinfo.ip("::ffff:192.0.2.3").ipv6_to_ipv4 #=> #<Addrinfo: 192.0.2.3>
Addrinfo.ip("::1").ipv6_to_ipv4 #=> nil
Addrinfo.i... -
OpenSSL
:: X509 :: Name # to _ s(flags=nil) -> String (18412.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... -
BigDecimal
# to _ json(*args) -> String (18394.0) -
自身を JSON 形式の文字列に変換して返します。
自身を JSON 形式の文字列に変換して返します。
内部的にはハッシュにデータをセットしてから JSON::Generator::GeneratorMethods::Hash#to_json を呼び出しています。
@param args 引数はそのまま JSON::Generator::GeneratorMethods::Hash#to_json
に渡されます。
//emlist[例][ruby]{
require 'json/add/bigdecimal'
BigDecimal('0.123456789123456789').to_json # => "{\"... -
Complex
# to _ json(*args) -> String (18394.0) -
自身を JSON 形式の文字列に変換して返します。
自身を JSON 形式の文字列に変換して返します。
内部的にはハッシュにデータをセットしてから JSON::Generator::GeneratorMethods::Hash#to_json を呼び出しています。
@param args 引数はそのまま JSON::Generator::GeneratorMethods::Hash#to_json
に渡されます。
//emlist[例][ruby]{
require 'json/add/complex'
Complex(2, 3).to_json # => "{\"json_class\":\"Complex\"... -
Date
# to _ json(*args) -> String (18394.0) -
自身を JSON 形式の文字列に変換して返します。
自身を JSON 形式の文字列に変換して返します。
内部的にはハッシュにデータをセットしてから JSON::Generator::GeneratorMethods::Hash#to_json を呼び出しています。
@param args 引数はそのまま JSON::Generator::GeneratorMethods::Hash#to_json に渡されます。
//emlist[例][ruby]{
require "json/add/core"
Date.today.to_json
# => "{\"json_class\":\"Date\",\"y\":2018,\"m\":12... -
DateTime
# to _ json(*args) -> String (18394.0) -
自身を JSON 形式の文字列に変換して返します。
自身を JSON 形式の文字列に変換して返します。
内部的にはハッシュにデータをセットしてから JSON::Generator::GeneratorMethods::Hash#to_json を呼び出しています。
@param args 引数はそのまま JSON::Generator::GeneratorMethods::Hash#to_json に渡されます。
//emlist[例][ruby]{
require "json/add/core"
DateTime.now.to_json
# => "{\"json_class\":\"DateTime\",\"y\":2018,\"... -
Integer
# to _ bn -> OpenSSL :: BN (18394.0) -
Integer を同じ数を表す OpenSSL::BN のオブジェクトに 変換します。
Integer を同じ数を表す OpenSSL::BN のオブジェクトに
変換します。
//emlist[][ruby]{
require 'openssl'
pp 5.to_bn #=> #<OpenSSL::BN 5>
pp (-5).to_bn #=> #<OpenSSL::BN -5>
//}
なお、実装は、以下のようになっています。
//emlist[][ruby]{
class Integer
def to_bn
OpenSSL::BN::new(self)
end
end
//}
@see OpenSSL::BN.new, OpenSSL::... -
Range
# to _ json(*args) -> String (18394.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]}"
//... -
Rational
# to _ json(*args) -> String (18394.0) -
自身を JSON 形式の文字列に変換して返します。
自身を JSON 形式の文字列に変換して返します。
内部的にはハッシュにデータをセットしてから JSON::Generator::GeneratorMethods::Hash#to_json を呼び出しています。
@param args 引数はそのまま JSON::Generator::GeneratorMethods::Hash#to_json
に渡されます。
//emlist[例][ruby]{
require 'json/add/rational'
Rational(1, 3).to_json # => "{\"json_class\":\"Rationa... -
Struct
# to _ json(*args) -> String (18394.0) -
自身を JSON 形式の文字列に変換して返します。
自身を JSON 形式の文字列に変換して返します。
内部的にはハッシュにデータをセットしてから JSON::Generator::GeneratorMethods::Hash#to_json を呼び出しています。
@param args 引数はそのまま JSON::Generator::GeneratorMethods::Hash#to_json に渡されます。
//emlist[例][ruby]{
require "json/add/core"
Person = Struct.new(:name, :age)
Person.new("tanaka", 29).to_json # =... -
Time
# to _ json(*args) -> String (18394.0) -
自身を JSON 形式の文字列に変換して返します。
自身を JSON 形式の文字列に変換して返します。
内部的にはハッシュにデータをセットしてから JSON::Generator::GeneratorMethods::Hash#to_json を呼び出しています。
@param args 引数はそのまま JSON::Generator::GeneratorMethods::Hash#to_json に渡されます。
//emlist[例][ruby]{
require "json/add/core"
Time.now.to_json # => "{\"json_class\":\"Time\",\"s\":1544968675,\"n\... -
Kernel
. # autoload(const _ name , feature) -> nil (18385.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 また... -
OpenStruct
# to _ h -> { Symbol => object } (18379.0) -
self を各要素の名前をキー(Symbol)、要素が値のハッシュに変換して返 します。
self を各要素の名前をキー(Symbol)、要素が値のハッシュに変換して返
します。
ブロックを指定すると各ペアでブロックを呼び出し、
その結果をペアとして使います。
//emlist[例][ruby]{
require 'ostruct'
data = OpenStruct.new("country" => "Australia", :capital => "Canberra")
data.to_h # => {:country => "Australia", :capital => "Canberra" }
data.to_h {|name, value| [name.to_... -
OpenStruct
# to _ h {|name , value| block } -> Hash (18379.0) -
self を各要素の名前をキー(Symbol)、要素が値のハッシュに変換して返 します。
self を各要素の名前をキー(Symbol)、要素が値のハッシュに変換して返
します。
ブロックを指定すると各ペアでブロックを呼び出し、
その結果をペアとして使います。
//emlist[例][ruby]{
require 'ostruct'
data = OpenStruct.new("country" => "Australia", :capital => "Canberra")
data.to_h # => {:country => "Australia", :capital => "Canberra" }
data.to_h {|name, value| [name.to_... -
IPAddr
# to _ s -> String (18376.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_string -
IPAddr
# to _ string -> String (18376.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 -
REXML
:: Elements # to _ a(xpath = nil) -> [REXML :: Element] (18376.0) -
すべての子要素の配列を返します。
すべての子要素の配列を返します。
xpath を指定した場合は、その XPath 文字列に
マッチする要素の配列を返します。
REXML::Elements#each と同様、REXML::XPath.match などと
異なり、要素以外の子ノードは無視されます。
@param xpath XPath文字列
//emlist[][ruby]{
require 'rexml/document'
require 'rexml/xpath'
doc = REXML::Document.new '<a>sean<b/>elliott<c/></a>'
doc.root.elements.to_... -
Rational
# to _ d(nFig) -> BigDecimal (18376.0) -
自身を BigDecimal に変換します。
自身を BigDecimal に変換します。
nFig 桁まで計算を行います。
@param nFig 計算を行う桁数
@return BigDecimal に変換したオブジェクト
@raise ArgumentError nFig に 0 以下を指定した場合に発生します。
//emlist[][ruby]{
require "bigdecimal"
require "bigdecimal/util"
p Rational(1, 3).to_d(3) # => 0.333e0
p Rational(1, 3).to_d(10) # => 0.3333333333e0
//} -
Regexp
# to _ json(*args) -> String (18376.0) -
自身を JSON 形式の文字列に変換して返します。
自身を JSON 形式の文字列に変換して返します。
内部的にはハッシュにデータをセットしてから JSON::Generator::GeneratorMethods::Hash#to_json を呼び出しています。
@param args 引数はそのまま JSON::Generator::GeneratorMethods::Hash#to_json
に渡されます。
//emlist[例][ruby]{
require "json/add/core"
/0\d{1,4}-\d{1,4}-\d{4}/.to_json # => "{\"json_class\":\"... -
Module
# autoload(const _ name , feature) -> nil (18367.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 の直下に定... -
CSV
:: Row # to _ csv -> String (18361.0) -
自身を CSV な文字列として返します。ヘッダは使用しません。
自身を CSV な文字列として返します。ヘッダは使用しません。
//emlist[例][ruby]{
require "csv"
row = CSV::Row.new(["header1", "header2"], [1, 2])
row.to_csv # => "1,2\n"
row.to_csv( {col_sep: "|", row_sep: "<br>"} ) # => "1|2<br>"
//} -
CSV
:: Row # to _ s -> String (18361.0) -
自身を CSV な文字列として返します。ヘッダは使用しません。
自身を CSV な文字列として返します。ヘッダは使用しません。
//emlist[例][ruby]{
require "csv"
row = CSV::Row.new(["header1", "header2"], [1, 2])
row.to_csv # => "1,2\n"
row.to_csv( {col_sep: "|", row_sep: "<br>"} ) # => "1|2<br>"
//} -
CSV
:: Table # to _ csv(options = Hash . new) -> String (18361.0) -
CSV の文字列に変換して返します。
CSV の文字列に変換して返します。
ヘッダを一行目に出力します。その後に残りのデータを出力します。
デフォルトでは、ヘッダを出力します。オプションに :write_headers =>
false を指定するとヘッダを出力しません。
//emlist[][ruby]{
require 'csv'
csv = CSV.new("a,b,c\n1,2,3", headers: true)
table = csv.read
p table.to_csv # => "a,b,c\n1,2,3\n"
p table.to_csv(write_head... -
CSV
:: Table # to _ s(options = Hash . new) -> String (18361.0) -
CSV の文字列に変換して返します。
CSV の文字列に変換して返します。
ヘッダを一行目に出力します。その後に残りのデータを出力します。
デフォルトでは、ヘッダを出力します。オプションに :write_headers =>
false を指定するとヘッダを出力しません。
//emlist[][ruby]{
require 'csv'
csv = CSV.new("a,b,c\n1,2,3", headers: true)
table = csv.read
p table.to_csv # => "a,b,c\n1,2,3\n"
p table.to_csv(write_head... -
JSON
:: State # to _ h -> Hash (18361.0) -
自身をハッシュに変換します。
自身をハッシュに変換します。
//emlist[例][ruby]{
require "json"
require "pp"
json_state = JSON::State.new
pp json_state.to_h
# => {:indent=>"",
# :space=>"",
# :space_before=>"",
# :object_nl=>"",
# :array_nl=>"",
# :allow_nan=>false,
# :ascii_only=>false,
# :max_nesting=>100,
# ... -
JSON
:: State # to _ hash -> Hash (18361.0) -
自身をハッシュに変換します。
自身をハッシュに変換します。
//emlist[例][ruby]{
require "json"
require "pp"
json_state = JSON::State.new
pp json_state.to_h
# => {:indent=>"",
# :space=>"",
# :space_before=>"",
# :object_nl=>"",
# :array_nl=>"",
# :allow_nan=>false,
# :ascii_only=>false,
# :max_nesting=>100,
# ... -
IPAddr
# to _ range -> Range (18358.0) -
self の IP アドレスとサブネットマスクで取得できる IP アドレスの範囲を Range オブジェクトとして返します。
self の IP アドレスとサブネットマスクで取得できる IP アドレスの範囲を
Range オブジェクトとして返します。
例:
require 'ipaddr'
IPAddr.new('192.168.1.1').to_range
#=> #<IPAddr: IPv4:192.168.1.1/255.255.255.255>..#<IPAddr: IPv4:192.168.1.1/255.255.255.255>
IPAddr.new('::1').to_range
#=> #<IPAddr: IPv6:0000:0000:0000:0000:0000:0000:... -
NilClass
# to _ d -> BigDecimal (18358.0) -
BigDecimal オブジェクトの 0.0 を返します。
BigDecimal オブジェクトの 0.0 を返します。
Ruby 2.6 で追加されたメソッドです。
//emlist[][ruby]{
require "bigdecimal"
require "bigdecimal/util"
p nil.to_d # => 0.0
//} -
Addrinfo
# to _ s -> String (18343.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" -
Addrinfo
# to _ sockaddr -> String (18343.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" -
CSV
:: Row # to _ hash -> Hash (18340.0) -
自身をシンプルなハッシュに変換します。
自身をシンプルなハッシュに変換します。
フィールドの順序は無視されます。
重複したフィールドは削除されます。
//emlist[例][ruby]{
require "csv"
row = CSV::Row.new(["header2", "header1", "header2"], [1, 2, 3])
row.to_hash # => {"header2"=>3, "header1"=>2}
//} -
CSV
:: Table # to _ a -> [Array] (18340.0) -
配列の配列を返します。
配列の配列を返します。
一番目の要素はヘッダで、残りの要素はデータを表わします。
//emlist[例][ruby]{
require "csv"
row1 = CSV::Row.new(["header1", "header2"], ["row1_1", "row1_2"])
row2 = CSV::Row.new(["header1", "header2"], ["row2_1", "row2_2"])
table = CSV::Table.new([row1, row2])
table.to_a # => [["header1", "header2"], ["row1_1", "... -
DBM
# to _ a -> [Array] (18340.0) -
キーと値のペアを配列に変換して返します。
キーと値のペアを配列に変換して返します。
require 'dbm'
db1 = DBM.open('aaa.db', 0666, DBM::NEWDB)
db1[:a] = 'aaa'
db1[:b] = 'bbbbbb'
p db1.to_a #=> [["b", "bbbbbb"], ["a", "aaa"]] -
DBM
# to _ hash -> Hash (18340.0) -
self をハッシュに変換して返します。
self をハッシュに変換して返します。
require 'dbm'
db1 = DBM.open('aaa.db', 0666, DBM::NEWDB)
db1[:a] = 'aaa'
db1[:b] = 'bbbbbb'
p db1.to_hash #=> {"a"=>"aaa", "b"=>"bbbbbb"} -
Fiddle
:: Pointer # to _ value -> object (18340.0) -
自身はヒープに確保された Ruby のオブジェクトを指すポインタであると仮定して、 自身が指すオブジェクトを返します。
自身はヒープに確保された Ruby のオブジェクトを指すポインタであると仮定して、
自身が指すオブジェクトを返します。
例:
require 'fiddle'
s = 'abc'
i = Fiddle.dlwrap(s)
cptr = Fiddle::Pointer.new(i)
p cptr.to_value #=> "abc" -
IPAddr
# to _ i -> Integer (18340.0) -
整数に変換します。
整数に変換します。
例:
require "ipaddr"
p IPAddr.new("0.0.1.0").to_i # => 256 -
Matrix
# to _ a -> Array (18340.0) -
自分自身をArrayに変換したものを返します。
自分自身をArrayに変換したものを返します。
行ベクトルを配列(Array)としたものの配列(つまり配列の配列)として返します。
//emlist[例][ruby]{
require 'matrix'
a1 = [ 1, 2, 3]
a2 = [10, 15, 20]
a3 = [-1, -2, 1.5]
m = Matrix[a1, a2, a3]
p m.to_a # => [[1, 2, 3], [10, 15, 20], [-1, -2, 1.5]]
//} -
Matrix
# to _ s -> String (18340.0) -
行列を文字列化し、その文字列を返します。
行列を文字列化し、その文字列を返します。
//emlist[例][ruby]{
require 'matrix'
a1 = [1, 2]
a2 = [3, 4.5]
m = Matrix[a1, a2]
p m.to_s # => "Matrix[[1, 2], [3, 4.5]]"
//} -
Net
:: HTTPResponse :: CODE _ CLASS _ TO _ OBJ -> Hash (18340.0) -
HTTP レスポンスステータスコードの最初の数字からレスポンスのクラス(分類)を あらわすクラスへのハッシュです。
HTTP レスポンスステータスコードの最初の数字からレスポンスのクラス(分類)を
あらわすクラスへのハッシュです。
//emlist[][ruby]{
require 'net/http'
Net::HTTPResponse::CODE_CLASS_TO_OBJ['3'] # => Net::HTTPRedirection
//} -
Net
:: HTTPResponse :: CODE _ TO _ OBJ -> Hash (18340.0) -
HTTP レスポンスステータスコードから対応するクラスへのハッシュです。
HTTP レスポンスステータスコードから対応するクラスへのハッシュです。
//emlist[][ruby]{
require 'net/http'
Net::HTTPResponse::CODE_TO_OBJ['404'] # => Net::HTTPNotFound
//} -
OpenSSL
:: X509 :: Name # to _ a -> [[String , String , Integer]] (18340.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... -
OptionParser
# to _ a -> [String] (18340.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"]
//} -
REXML
:: Attribute # to _ string -> String (18340.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'"
//} -
REXML
:: Attributes # to _ a -> [Attribute] (18340.0) -
属性の配列を返します。
属性の配列を返します。
//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new("<a x='1' y='2' z='3' />")
doc.root.attributes.to_a # => [x='1', y='2', z='3']
//} -
REXML
:: CData # to _ s -> String (18340.0) -
テキスト文字列を返します。
テキスト文字列を返します。
@see REXML::Text#value, REXML::Text#to_s
//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new(<<EOS)
<root><![CDATA[foobar baz]]></root>
EOS
doc.root[0].class # => REXML::CData
doc.root[0].value # => "foobar baz"
//} -
REXML
:: Text # to _ s -> String (18340.0) -
テキストの内容を正規化(すべての実体をエスケープ)された状態で返します。
テキストの内容を正規化(すべての実体をエスケープ)された状態で返します。
つまり返り値は XML のテキストとして妥当です。
結果は REXML::Text.new で指定した entity_filter を反映しています。
@see REXML::Text#value
//emlist[][ruby]{
require 'rexml/document'
t = REXML::Text.new("< & foobar", false, nil, false)
t.to_s # => "< & foobar"
t.value # => "< & foobar"
//} -
RubyVM
:: InstructionSequence # to _ a -> Array (18340.0) -
self の情報を 14 要素の配列にして返します。
self の情報を 14 要素の配列にして返します。
命令シーケンスを以下の情報で表します。
: magic
データフォーマットを示す文字列。常に
"YARVInstructionSequence/SimpleDataFormat"。
: major_version
命令シーケンスのメジャーバージョン。
: minor_version
命令シーケンスのマイナーバージョン。
: format_type
データフォーマットを示す数値。常に 1。
: misc
以下の要素から構成される Hash オブジェクト。
:arg_size: メソッド、ブ... -
SDBM
# to _ a -> [[String]] (18340.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"]] -
SDBM
# to _ hash -> Hash (18340.0) -
self の各要素を格納したハッシュを返します。
self の各要素を格納したハッシュを返します。
require 'sdbm'
db1 = SDBM.open('aaa.gdbm', 0666)
db1.clear
db1['a'] = 'aaa'
db1['b'] = 'bbb'
db1['c'] = 'ccc'
p db1.to_hash #=> {"a"=>"aaa", "b"=>"bbb", "c"=>"ccc"} -
URI
:: Generic # route _ to(dst) -> URI :: Generic (18340.0) -
自身から dst への相対パスを返します。
自身から dst への相対パスを返します。
@param dst URI を文字列かURIオブジェクトで与えます。
例:
require 'uri'
p URI.parse('http://example.com/').route_to('http://example.com/foo/bar.html')
#=> #<URI::Generic:0x20100198 URL:foo/bar.html> -
URI
:: Generic # to _ s -> String (18340.0) -
自身が表す URI を文字列として返します。
自身が表す URI を文字列として返します。
例:
require 'uri'
p URI.parse('http://example.com/').to_s #=> "http://example.com/" -
WEBrick
:: HTTPResponse # to _ s -> String (18340.0) -
実際にクライアントに送られるデータを文字列として返します。
実際にクライアントに送られるデータを文字列として返します。
require 'webrick'
include WEBrick
res = HTTPResponse.new( { :HTTPVersion => "1.1" } )
res.body = 'hoge'
print res.to_s
#=> 出力結果
HTTP/1.1 200 OK
Connection: Keep-Alive
Date: Sat, 27 Oct 2007 08:58:49 GMT
Server:
Content-Length: 4
hoge -
WEBrick
:: HTTPVersion # to _ s -> String (18340.0) -
自身を文字列に変換して返します。
自身を文字列に変換して返します。
require 'webrick'
v = WEBrick::HTTPVersion.new('1.1')
p v.to_s #=> "1.1" -
OptionParser
# separator(sep) -> () (18337.0) -
サマリにオプションを区切るための文字列 sep を挿入します。 オプションにいくつかの種類がある場合に、サマリがわかりやすくなります。
サマリにオプションを区切るための文字列 sep を挿入します。
オプションにいくつかの種類がある場合に、サマリがわかりやすくなります。
サマリには on メソッドを呼んだ順にオプションが表示されるので、区切りを挿入したい
ところでこのメソッドを呼びます。
@param sep サマリの区切りを文字列で指定します。
//emlist[][ruby]{
require 'optparse'
opts = OptionParser.new
opts.banner = "Usage: example.rb [options]"
opts.separator ""
opts.separator... -
Pathname
# to _ s -> String (18322.0) -
パス名を文字列で返します。
パス名を文字列で返します。
//emlist[例][ruby]{
require 'pathname'
path = Pathname.new("/tmp/hogehoge")
File.open(path)
//} -
RDoc
:: Context # add _ to(array , thing) -> () (18322.0) -
array に thing を追加します。
array に thing を追加します。
@param array 配列を指定します。
@param thing 追加する要素を指定します。
RDoc::Context#add_alias などで使われています。ライブラリ内部で使
用します。
@see RDoc::Context#add_alias, RDoc::Context#add_attribute,
RDoc::Context#add_constant, RDoc::Context#add_include,
RDoc::Context#add_method, RDoc::Context#add_requ... -
Addrinfo
# protocol -> Integer (18319.0) -
ソケットプロトコルを整数で返します。
ソケットプロトコルを整数で返します。
require 'socket'
Addrinfo.tcp("localhost", 80).protocol == Socket::IPPROTO_TCP #=> true -
DBM
# store(key , value) -> String (18319.0) -
key に対して value を格納します。
key に対して value を格納します。
@param key キー。
@param value 値。
@see DBM#[]=
require 'dbm'
db1 = DBM.open('aaa.db', 0666, DBM::NEWDB)
p db1.store('c', 'ccc') #=> "ccc" -
Date
. today(start = Date :: ITALY) -> Date (18319.0) -
現在の日付に相当する日付オブジェクトを生成します。
現在の日付に相当する日付オブジェクトを生成します。
@param start グレゴリオ暦をつかい始めた日をあらわすユリウス日
//emlist[例][ruby]{
require 'date'
Date.today # => #<Date: 2017-09-20 ...>
//} -
FileUtils
. # touch(list , options = {}) -> () (18319.0) -
list で指定されたファイルの最終変更時刻 (mtime) と アクセス時刻 (atime) を変更します。
list で指定されたファイルの最終変更時刻 (mtime) と
アクセス時刻 (atime) を変更します。
list で指定されたファイルが存在しない場合は空のファイルを作成します。
@param list 対象のファイル。一つの場合は文字列も指定可能です。
二つ以上指定する場合は配列で指定します。
@param options :mtime, :nocreate, :noop, :verbose が指定できます。
c:FileUtils#options
//emlist[][ruby]{
require 'fileutils... -
FileUtils
. # uptodate?(newer , older _ list , options = nil) -> bool (18319.0) -
newer が、older_list に含まれるすべてのファイルより新しいとき真。 存在しないファイルは無限に古いとみなされます。
newer が、older_list に含まれるすべてのファイルより新しいとき真。
存在しないファイルは無限に古いとみなされます。
@param newer ファイルを一つ指定します。
@param older_list ファイル名の配列を指定します。
@param options どのようなオプションも指定することはできません。
@raise ArgumentError options にオプションを指定した場合に発生します。
//emlist[][ruby]{
require 'fileutils'
FileUtils.uptodate?('hello.o', ['hello.... -
Forwardable
# def _ delegator(accessor , method , ali = method) -> () (18319.0) -
メソッドの委譲先を設定します。
メソッドの委譲先を設定します。
@param accessor 委譲先のオブジェクト
@param method 委譲先のメソッド
@param ali 委譲元のメソッド
委譲元のオブジェクトで ali が呼び出された場合に、
委譲先のオブジェクトの method へ処理が委譲されるようになります。
委譲元と委譲先のメソッド名が同じ場合は, ali を省略することが可能です。
def_delegator は def_instance_delegator の別名になります。
//emlist[例][ruby]{
require 'forwardable'
class MyQue...