るりまサーチ

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

別のキーワード

  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 (18369.0)

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

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

header が nil
でなければ、リクエストを送るときにその内容を HTTP ヘッダとして
送ります。 header は { 'Accept' = > '*/*', ... } という...
...て順次
「dest << ボディの断片」を実行します。

@
param path 取得するエンティティのパスを文字列で指定します。
@
param header リクエストの HTTP ヘッダをハッシュで指定します。
@
param dest 利用しないでください。

1.1 互換モード...
...//emlist[例][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('/~...

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

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

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

header が nil
でなければ、リクエストを送るときにその内容を HTTP ヘッダとして
送ります。 header は { 'Accept' = > '*/*', ... } という...
...て順次
「dest << ボディの断片」を実行します。

@
param path 取得するエンティティのパスを文字列で指定します。
@
param header リクエストの HTTP ヘッダをハッシュで指定します。
@
param dest 利用しないでください。

1.1 互換モード...
...//emlist[例][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('/~...

REXML::Attributes#get_attribute_ns(namespace, name) -> REXML::Attribute | nil (15356.0)

namespace と name で特定される属性を返します。

...prefix を含まない属性名を
指定します。

指定された属性が存在しない場合は nil を返します。

XML プロセッサが prefix を置き換えてしまった場合でも、このメソッドを
使うことで属性を正しく指定することができます。

@
par...
...URI, 文字列)
@
param name 属性名(文字列)

//emlist[][ruby]{
require 'rexml/document'

doc = REXML::Document.new(<<-EOS)
<root xmlns:foo="http://example.org/foo"
xmlns:bar="http://example.org/bar">
<a foo:att='1' bar:att='2' att='&lt;'/>
</root>
EOS
a = doc.get_elements("/root/a").fir...
...st

a.attributes.get_attribute_ns("", "att") # => att='&lt;'
a.attributes.get_attribute_ns("http://example.org/foo", "att") # => foo:att='1'
a.attributes.get_attribute_ns("http://example.org/baz", "att") # => nil
a.attributes.get_attribute_ns("http://example.org/foo", "attt") # => nil
//}...

REXML::Attributes#get_attribute(name) -> Attribute | nil (15344.0)

name という名前の属性を取得します。

...う名前の属性を取得します。

name という名前を持つ属性がない場合は nil を返します。

@
param name 属性名(文字列)
@
see REXML::Attributes#[]

//emlist[][ruby]{
require 'rexml/document'

doc = REXML::Document.new(<<-EOS)
<root xmlns:foo="http://example.org/foo"...
...xmlns:bar="http://example.org/bar">
<a foo:att='1' bar:att='2' att='&lt;'/>
</root>
EOS
a = doc.get_elements("/root/a").first

a.attributes.get_attribute("att") # => att='&lt;'
a.attributes.get_attribute("foo:att") # => foo:att='1'
//}...

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

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

...

@
param symbol ローカル変数名を Symbol オブジェクトで指定します。

@
raise NameError 引数 symbol で指定したローカル変数が未定義の場合に発生します。

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

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

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

@
see Binding#local_variable_set, Binding#local_variable_defined?...

絞り込み条件を変える

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

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

...ば nil を返します。

@
param var インスタンス変数名を文字列か 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.instanc...
...e_variable_get(:@bar) #=> nil
//}

@
see Object#instance_variable_set,Object#instance_variables,Object#instance_variable_defined?...

Object#instance_variable_defined?(var) -> bool (12243.0)

インスタンス変数 var が定義されていたら真を返します。

...す。

@
param var インスタンス変数名を文字列か Symbol で指定します。

//emlist[][ruby]{
class Fred
def initialize(p1, p2)
@
a, @b = p1, p2
end
end
fred = Fred.new('cat', 99)
p fred.instance_variable_defined?(:@a) #=> true
p fred.instance_variable_defined?("@b") #=>...
...true
p fred.instance_variable_defined?("@c") #=> false
//}

@
see Object#instance_variable_get,Object#instance_variable_set,Object#instance_variables...

Net::HTTPHeader#get_fields(key) -> [String] (12238.0)

key ヘッダフィールドの値 (文字列) を配列で返します。

...を区別しません。

@
param key ヘッダフィール名を文字列で与えます。

//emlist[例][ruby]{
require 'net/http'

uri = URI.parse('http://www.example.com/index.html')
res = Net::HTTP.get_response(uri)
res.get_fields('accept-ranges') # => ["none"]
//}

@
see Net::HTTPHeader#[] , Ne...
...t::HTTPHeader#[]=,
Net::HTTPHeader#add_field...

Module#class_variable_get(name) -> object (12232.0)

クラス/モジュールに定義されているクラス変数 name の値を返します。

...name の値を返します。

@
param name String または Symbol を指定します。

@
raise NameError クラス変数 name が定義されていない場合、発生します。

//emlist[例][ruby]{
class Fred
@
@foo = 99
end

def Fred.foo
class_variable_get(:@@foo)
end

p Fred.foo #=> 99
/...
<< 1 2 3 ... > >>