るりまサーチ

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

別のキーワード

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

ライブラリ

クラス

モジュール

キーワード

検索結果

<< 1 2 3 ... > >>

REXML::Text#value -> String (21338.0)

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

...

このメソッドの返り値では raw モードや entity_filter は無視されます。

@
see REXML::Text#raw, REXML::Text#to_s

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

WIN32OLE_VARIANT#value -> object (21336.0)

値に対応するRubyオブジェクトを取得します。

...値に対応するRubyオブジェクトを取得します。

@
return 値に対応するRubyのオブジェクトを返します。

obj = WIN32OLE_VARIANT.new(1, WIN32OLE::VARIANT::VT_BSTR)
obj.value # => "1" (VT_BSTRを指定して生成したので、Stringオブジェクトとなる)...

OpenSSL::ASN1::ASN1Data#value -> object (21330.0)

ASN.1 値に対応するRubyのオブジェクトを返します。

...ASN.1 値に対応するRubyのオブジェクトを返します。

@
see OpenSSL::ASN1::ASN1Data#value=...

Net::HTTPResponse#value -> nil (21250.0)

レスポンスが 2xx(成功)でなかった場合に、対応する 例外を発生させます。

...させます。

@
raise HTTPError レスポンスが 1xx であるか、 net/http が知らない
種類のレスポンスである場合に発生します。
@
raise HTTPRetriableError レスポンスが 3xx である場合に発生します。
@
raise HTTPServerException レスポ...
...す。
@
raise HTTPFatalError レスポンスが 5xx である場合に発生します。

//emlist[例 レスポンスが 2xx(成功)][ruby]{
require 'net/http'

uri = "http://www.example.com/index.html"
response = Net::HTTP.get_response(URI.parse(uri))
response.value # => nil
//}

//emlist[例 レ...
...スポンスが 2xx以外][ruby]{
require 'net/http'

uri = "http://www.example.com/invalid.html"
response = Net::HTTP.get_response(URI.parse(uri))
begin
response.value
rescue => e
e.class # => Net::HTTPServerException
e.message # => 404 "Not Found"
end
//}...

REXML::CData#value -> String (18326.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"
//}...

絞り込み条件を変える

Hash#transform_values {|value| ... } -> Hash (12432.0)

すべての値に対してブロックを呼び出した結果で置き換えたハッシュを返します。 キーは変化しません。

...

@
return 置き換えたハッシュを返します。
ブロックが与えられなかった場合は、Enumerator オブジェクトを
返します。

//emlist[例][ruby]{
h = { a: 1, b: 2, c: 3 }
h.transform_values {|v| v * v + 1 } #=> { a: 2, b: 5, c: 10 }
h.transform_values...
...(&:to_s) #=> { a: "1", b: "2", c: "3" }
h.transform_values.with_index {|v, i| "#{v}.#{i}" }
#=> { a: "1.0", b: "2.1", c: "3.2" }
//}

@
see Hash#transform_values!
@
see Hash#transform_keys
@
see Hash#transform_keys!...

Hash#transform_values! {|value| ... } -> self (12432.0)

すべての値に対してブロックを呼び出した結果でハッシュの値を変更します。 キーは変化しません。

...

@
return transform_values! は常に self を返します。
ブロックが与えられなかった場合は、Enumerator オブジェクトを
返します。

//emlist[例][ruby]{
h = { a: 1, b: 2, c: 3 }
h.transform_values! {|v| v * v + 1 } #=> { a: 2, b: 5, c: 10 }
h.transf...
...orm_values!(&:to_s) #=> { a: "2", b: "5", c: "10" }
h.transform_values!.with_index {|v, i| "#{v}.#{i}" }
#=> { a: "2.0", b: "5.1", c: "10.2" }
//}

@
see Hash#transform_values
@
see Hash#transform_keys
@
see Hash#transform_keys!...

Hash#transform_values {|value| ... } -> Hash (12420.0)

すべての値に対してブロックを呼び出した結果で置き換えたハッシュを返します。 キーは変化しません。

...

@
return 置き換えたハッシュを返します。
ブロックが与えられなかった場合は、Enumerator オブジェクトを
返します。

//emlist[例][ruby]{
h = { a: 1, b: 2, c: 3 }
h.transform_values {|v| v * v + 1 } #=> { a: 2, b: 5, c: 10 }
h.transform_values...
...(&:to_s) #=> { a: "1", b: "2", c: "3" }
h.transform_values.with_index {|v, i| "#{v}.#{i}" }
#=> { a: "1.0", b: "2.1", c: "3.2" }
//}

@
see Hash#transform_values!...

Hash#transform_values! {|value| ... } -> self (12420.0)

すべての値に対してブロックを呼び出した結果でハッシュの値を変更します。 キーは変化しません。

...

@
return transform_values! は常に self を返します。
ブロックが与えられなかった場合は、Enumerator オブジェクトを
返します。

//emlist[例][ruby]{
h = { a: 1, b: 2, c: 3 }
h.transform_values! {|v| v * v + 1 } #=> { a: 2, b: 5, c: 10 }
h.transf...
...orm_values!(&:to_s) #=> { a: "2", b: "5", c: "10" }
h.transform_values!.with_index {|v, i| "#{v}.#{i}" }
#=> { a: "2.0", b: "5.1", c: "10.2" }
//}

@
see Hash#transform_values...

Array#values_at(*selectors) -> Array (12349.0)

引数で指定されたインデックスに対応する要素を配列で返します。インデッ クスに対応する値がなければ nil が要素になります。

...す。

@
param selectors インデックスを整数もしくは整数の Range で指定します。

//emlist[例][ruby]{
ary = %w( a b c d e )
p ary.values_at( 0, 2, 4 ) #=> ["a", "c", "e"]
p ary.values_at( 3, 4, 5, 6, 35 ) #=> ["d", "e", nil, nil, nil]
p ary.values_at( 0, -1, -2 )...
...> ["a", "e", "d"]
p ary.values_at( -4, -5, -6, -35 ) #=> ["b", "a", nil, nil]
p ary.values_at( 1..2 ) #=> ["b", "c"]
p ary.values_at( 3..10 ) #=> ["d", "e", nil, nil, nil, nil, nil, nil]
p ary.values_at( 6..7 ) #=> [nil, nil]
p ary.values_at( 0, 3..5 ) #=...

絞り込み条件を変える

MatchData#values_at(*index) -> [String] (12343.0)

正規表現中の n 番目の括弧にマッチした部分文字列の配列を返します。

...列全体を表します。

@
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) # => ["fo...
...z", "foo", "bar", "baz", nil]
p m.values_at(-1, -2, -3, -4, -5) # => ["baz", "bar", "foo", nil, nil]

m = /(?<a>\d+) *(?<op>[+\-*\/]) *(?<b>\d+)/.match("1 + 2")
m.to_a # => ["1 + 2", "1", "+", "2"]
m.values_at(:a, :b, :op) # => ["1", "2", "+"]
//}

@
see Array#values_at, Array#[]...
<< 1 2 3 ... > >>