るりまサーチ

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

別のキーワード

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

検索結果

<< 1 2 3 ... > >>

Net::HTTP#get(path, header = nil, dest = nil) -> Net::HTTPResponse (18151.0)

サーバ上の path にあるエンティティを取得し、 Net::HTTPResponse のインスタンスとして返します。

...ist[例][ruby]{
# net/http version 1.1
response, body = http.get( '/index.html' )

# net/http version 1.2
response = http.get('/index.html')

# compatible in both version
response , = http.get('/index.html')
response.body

# compatible, using block
File.open('save.txt', 'w') {|f|
http.get('/~foo/'...
..., nil) do |str|
f.write str
end

}
//}

@see Net::HTTP#request_get...

Net::HTTP#get(path, header = nil, dest = nil) {|body_segment| .... } -> Net::HTTPResponse (18151.0)

サーバ上の path にあるエンティティを取得し、 Net::HTTPResponse のインスタンスとして返します。

...ist[例][ruby]{
# net/http version 1.1
response, body = http.get( '/index.html' )

# net/http version 1.2
response = http.get('/index.html')

# compatible in both version
response , = http.get('/index.html')
response.body

# compatible, using block
File.open('save.txt', 'w') {|f|
http.get('/~foo/'...
..., nil) do |str|
f.write str
end

}
//}

@see Net::HTTP#request_get...

Module#const_get(name, inherit = true) -> object (6162.0)

name で指定される名前の定数の値を取り出します。

...す。

//emlist[例][ruby]{
module Bar
BAR = 1
end

class Object
include Bar
end

# Object では include されたモジュールに定義された定数を見付ける
p Object.const_get(:BAR) # => 1

class Baz
include Bar
end

# Object以外でも同様
p Baz.const_get(:BAR) # => 1
#...
...定義されていない定数
p Baz.const_get(:NOT_DEFINED) #=> raise NameError
# 第二引数に false を指定すると自分自身に定義された定数から探す
p Baz.const_get(:BAR, false) #=> raise NameError
# 完全修飾名を指定すると include や自分自身へ定義されて...
...いない場合でも参照できる
p Class.const_get("Bar::BAR") # => 1
//}...

Net::HTTP#get2(path, header = nil) -> Net::HTTPResponse (6147.0)

サーバ上の path にあるエンティティを取得します。 Net::HTTPResponse オブジェクトを返します。

...][ruby]{
# example
response = http.request_get('/index.html')
p response['content-type']
puts response.body # body is already read

# using block
http.request_get('/index.html') {|response|
p response['content-type']
response.read_body do |str| # read body now
print str
end

}
//...
...}

get2 は時代遅れなので使わないでください。

@see Net::HTTP#get, Net::HTTPResponse#read_body...

Net::HTTP#get2(path, header = nil) {|response| .... } -> Net::HTTPResponse (6147.0)

サーバ上の path にあるエンティティを取得します。 Net::HTTPResponse オブジェクトを返します。

...][ruby]{
# example
response = http.request_get('/index.html')
p response['content-type']
puts response.body # body is already read

# using block
http.request_get('/index.html') {|response|
p response['content-type']
response.read_body do |str| # read body now
print str
end

}
//...
...}

get2 は時代遅れなので使わないでください。

@see Net::HTTP#get, Net::HTTPResponse#read_body...

絞り込み条件を変える

Net::HTTP#request_get(path, header = nil) -> Net::HTTPResponse (6147.0)

サーバ上の path にあるエンティティを取得します。 Net::HTTPResponse オブジェクトを返します。

...][ruby]{
# example
response = http.request_get('/index.html')
p response['content-type']
puts response.body # body is already read

# using block
http.request_get('/index.html') {|response|
p response['content-type']
response.read_body do |str| # read body now
print str
end

}
//...
...}

get2 は時代遅れなので使わないでください。

@see Net::HTTP#get, Net::HTTPResponse#read_body...

Net::HTTP#request_get(path, header = nil) {|response| .... } -> Net::HTTPResponse (6147.0)

サーバ上の path にあるエンティティを取得します。 Net::HTTPResponse オブジェクトを返します。

...][ruby]{
# example
response = http.request_get('/index.html')
p response['content-type']
puts response.body # body is already read

# using block
http.request_get('/index.html') {|response|
p response['content-type']
response.read_body do |str| # read body now
print str
end

}
//...
...}

get2 は時代遅れなので使わないでください。

@see Net::HTTP#get, Net::HTTPResponse#read_body...

Binding#local_variable_get(symbol) -> object (6144.0)

引数 symbol で指定した名前のローカル変数に設定された値を返します。

...定義の場合に発生します。

//emlist[例][ruby]{
def foo
a = 1
binding.local_variable_get(:a) # => 1
binding.local_variable_get(:b) # => NameError
end

//}

このメソッドは以下のコードの短縮形です。

//emlist[][ruby]{
binding.eval("#{symbol}")
//}

@see Binding#loca...

Object#instance_variable_get(var) -> object | nil (6144.0)

オブジェクトのインスタンス変数の値を取得して返します。

...文字列か Symbol で指定します。

//emlist[][ruby]{
class Foo
def initialize
@foo = 1
end

end


obj = Foo.new
p obj.instance_variable_get("@foo") #=> 1
p obj.instance_variable_get(:@foo) #=> 1
p obj.instance_variable_get(:@bar) #=> nil
//}

@see Object#instance_variable...
<< 1 2 3 ... > >>