1065件ヒット
[1-100件を表示]
(0.134秒)
別のキーワード
ライブラリ
- ビルトイン (683)
- bigdecimal (24)
- csv (48)
- digest (24)
- erb (12)
- json (12)
- matrix (24)
- openssl (12)
- optparse (24)
- pathname (24)
- rake (24)
-
rexml
/ document (96) -
rubygems
/ requirement (12) -
rubygems
/ version (24) - set (10)
- stringio (12)
クラス
- Array (36)
- BigDecimal (24)
-
CSV
:: Row (24) -
CSV
:: Table (24) - Complex (12)
- Data (6)
-
Digest
:: Base (24) - ERB (12)
- Encoding (24)
- Exception (24)
- FalseClass (24)
- Float (24)
-
Gem
:: Requirement (12) -
Gem
:: Version (24) - Hash (24)
- IO (12)
- Integer (24)
- MatchData (12)
- Matrix (12)
- Method (24)
- Module (36)
- NilClass (12)
- Object (39)
-
OpenSSL
:: BN (12) - OptionParser (24)
- Pathname (24)
- Proc (24)
-
REXML
:: Attribute (12) -
REXML
:: CData (24) -
REXML
:: DocType (12) -
REXML
:: Element (12) -
REXML
:: Entity (12) -
REXML
:: Text (24) -
Rake
:: FileList (12) -
Rake
:: InvocationChain (12) - Range (24)
- Rational (24)
- Regexp (24)
- Set (16)
- String (108)
- StringIO (12)
- Struct (24)
- Symbol (11)
- Thread (16)
-
Thread
:: Backtrace :: Location (24) - Time (18)
- TrueClass (12)
- UnboundMethod (24)
- UncaughtThrowError (11)
- Vector (12)
モジュール
キーワード
- % (12)
-
add
_ element (12) - binread (12)
- entities (12)
- help (12)
- hex (12)
- hexdigest (12)
- inspect (193)
- intern (12)
- join (12)
- name (29)
- oct (12)
- src (12)
-
start
_ with? (6) - syswrite (12)
- then (7)
-
to
_ csv (24) -
to
_ f (12) -
to
_ i (12) -
to
_ json (12) -
to
_ str (24) -
to
_ string (12) -
to
_ sym (12) - value (24)
- version (12)
- write (12)
-
yield
_ self (8)
検索結果
先頭5件
-
String
# to _ s -> String (30352.0) -
self を返します。
...t[例][ruby]{
p "str".to_s # => "str"
p "str".to_str # => "str"
//}
このメソッドは、文字列を他のクラスのインスタンスと混ぜて処理したいときに有効です。
例えば返り値が文字列か nil であるメソッド some_method があるとき、
to_s メ......ソッドを使うと以下のように統一的に処理できます。
//emlist[例][ruby]{
# some_method(5).downcase だと返り値が nil のときに
# エラーになるので to_s をはさむ
p some_method(5).to_s.downcase
//}... -
Gem
:: Requirement # to _ s -> String (24321.0) -
条件を表す文字列を返します。
...条件を表す文字列を返します。
//emlist[][ruby]{
req = Gem::Requirement.new(["< 5.0", ">= 1.9"])
p req.to_s # => "< 5.0, >= 1.9"
//}... -
UncaughtThrowError
# to _ s -> String (24321.0) -
self を tag を含む文字列表現にして返します。
...self を tag を含む文字列表現にして返します。
//emlist[例][ruby]{
def do_complicated_things
throw :uncaught_label
end
begin
do_complicated_things
rescue UncaughtThrowError => ex
p ex.to_s # => "uncaught throw :uncaught_label"
end
//}... -
String
# to _ str -> String (21352.0) -
self を返します。
...t[例][ruby]{
p "str".to_s # => "str"
p "str".to_str # => "str"
//}
このメソッドは、文字列を他のクラスのインスタンスと混ぜて処理したいときに有効です。
例えば返り値が文字列か nil であるメソッド some_method があるとき、
to_s メ......ソッドを使うと以下のように統一的に処理できます。
//emlist[例][ruby]{
# some_method(5).downcase だと返り値が nil のときに
# エラーになるので to_s をはさむ
p some_method(5).to_s.downcase
//}... -
Regexp
# to _ s -> String (21351.0) -
正規表現の文字列表現を生成して返します。返される文字列は他の正規表 現に埋め込んでもその意味が保持されるようになっています。
...現に埋め込んでもその意味が保持されるようになっています。
//emlist[][ruby]{
re = /foo|bar|baz/i
p re.to_s # => "(?i-mx:foo|bar|baz)"
p /#{re}+/o # => /(?i-mx:foo|bar|baz)+/
//}
ただし、後方参照を含む正規表現は意図通りにはならない場合......//emlist[][ruby]{
re = /(foo|bar)\1/ # \1 は、foo か bar
p /(baz)#{re}/ # \1 は、baz
# => /(baz)(?-mix:(foo|bar)\1)/
//}
//emlist[使用例][ruby]{
re = /foo|bar|baz/i
p re.to_s # => "(?i-mx:foo|bar|baz)"
p /#{re}+/o # => /(?i-mx:foo|bar|baz)+/
//}
@see Regexp#inspec... -
Range
# to _ s -> String (21343.0) -
self を文字列に変換します(始端と終端のオブジェクトは #to_s メソッドで文 字列に変換されます)。
...self を文字列に変換します(始端と終端のオブジェクトは #to_s メソッドで文
字列に変換されます)。
@see Range#inspect
//emlist[例][ruby]{
(1..5).to_s # => "1..5"
("1".."5").to_s # => "1..5"
//}... -
Rational
# to _ s -> String (21339.0) -
自身を人間が読みやすい形の文字列表現にして返します。
..."-17/7" のように10進数の表記を返します。
@return 有理数の表記にした文字列を返します。
//emlist[例][ruby]{
Rational(3, 4).to_s # => "3/4"
Rational(8).to_s # => "8/1"
Rational(-8, 6).to_s # => "-4/3"
Rational(0.5).to_s # => "1/2"
//}
@see Rational#inspect... -
Vector
# to _ s -> String (21337.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
:: Version # to _ s -> String (21322.0) -
バージョン情報を文字列として返します。
...バージョン情報を文字列として返します。
//emlist[][ruby]{
version = Gem::Version.new("1.2.3a")
p version.to_s # => "1.2.3a"
p version.version # => "1.2.3a"
//}...