るりまサーチ

最速Rubyリファレンスマニュアル検索!
1589件ヒット [1-100件を表示] (0.202秒)

別のキーワード

  1. fiddle ruby_free
  2. rbconfig ruby
  3. fiddle build_ruby_platform
  4. rake ruby
  5. rubygems/defaults ruby_engine

ライブラリ

キーワード

検索結果

<< 1 2 3 ... > >>

Gem::Requirement#to_s -> String (30320.0)

条件を表す文字列を返します。

...条件を表す文字列を返します。

//emlist[][ruby]{
r
eq = Gem::Requirement.new(["< 5.0", ">= 1.9"])
p req.to_s # => "< 5.0, >= 1.9"
//}...

UncaughtThrowError#to_s -> String (30320.0)

self を tag を含む文字列表現にして返します。

...self を tag を含む文字列表現にして返します。

//emlist[例][ruby]{
def do_complicated_things
t
hrow :uncaught_label
end

begin
do_complicated_things
r
escue UncaughtThrowError => ex
p ex.to_s # => "uncaught throw :uncaught_label"
end
//}...

Vector#to_s -> String (30320.0)

ベクトル(Vector)から文字列 (String) に変換します。

...ベクトル(Vector)から文字列 (String) に変換します。

//emlist[例][ruby]{
r
equire 'matrix'

v = Vector[2, 3, 5, 7, 9]
p v.to_s
# => "Vector[2, 3, 5, 7, 9]"
//}...

Regexp#to_s -> String (27350.0)

正規表現の文字列表現を生成して返します。返される文字列は他の正規表 現に埋め込んでもその意味が保持されるようになっています。

...現に埋め込んでもその意味が保持されるようになっています。

//emlist[][ruby]{
r
e = /foo|bar|baz/i
p re.to_s # => "(?i-mx:foo|bar|baz)"
p /#{re}+/o # => /(?i-mx:foo|bar|baz)+/
//}

ただし、後方参照を含む正規表現は意図通りにはならない場...
...emlist[][ruby]{
r
e = /(foo|bar)\1/ # \1 は、foo か bar
p /(baz)#{re}/ # \1 は、baz

# => /(baz)(?-mix:(foo|bar)\1)/
//}

//emlist[使用例][ruby]{
r
e = /foo|bar|baz/i
p re.to_s # => "(?i-mx:foo|bar|baz)"
p /#{re}+/o # => /(?i-mx:foo|bar|baz)+/
//}

@see Regexp#inspect...

String#to_s -> String (27350.0)

self を返します。

...list[例][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
//}...

絞り込み条件を変える

Range#to_s -> String (27342.0)

self を文字列に変換します(始端と終端のオブジェクトは #to_s メソッドで文 字列に変換されます)。

...self を文字列に変換します(始端と終端のオブジェクトは #to_s メソッドで文
字列に変換されます)。

@see Range#inspect

//emlist[例][ruby]{
(1..5).to_s # => "1..5"
("1".."5").to_s # => "1..5"
//}...

REXML::Text#to_s -> String (27338.0)

テキストの内容を正規化(すべての実体をエスケープ)された状態で返します。

...トとして妥当です。

結果は REXML::Text.new で指定した entity_filter を反映しています。

@see REXML::Text#value

//emlist[][ruby]{
r
equire 'rexml/document'
t
= REXML::Text.new("< & foobar", false, nil, false)
t
.to_s # => "&lt; &amp; foobar"
t
.value # => "< & foobar"
//}...

Rational#to_s -> String (27338.0)

自身を人間が読みやすい形の文字列表現にして返します。

..."-17/7" のように10進数の表記を返します。

@return 有理数の表記にした文字列を返します。

//emlist[例][ruby]{
R
ational(3, 4).to_s # => "3/4"
R
ational(8).to_s # => "8/1"
R
ational(-8, 6).to_s # => "-4/3"
R
ational(0.5).to_s # => "1/2"
//}

@see Rational#inspect...

Gem::Version#to_s -> String (27320.0)

バージョン情報を文字列として返します。

...バージョン情報を文字列として返します。

//emlist[][ruby]{
version = Gem::Version.new("1.2.3a")
p version.to_s # => "1.2.3a"
p version.version # => "1.2.3a"
//}...
<< 1 2 3 ... > >>