るりまサーチ

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

別のキーワード

  1. _builtin hash
  2. hash []
  3. matrix hash
  4. dbm to_hash
  5. _builtin to_hash

ライブラリ

クラス

モジュール

キーワード

検索結果

<< < 1 2 >>

JSON::Parser.new(source, options => {}) -> JSON::Parser (3113.0)

パーサを初期化します。

...せん。デフォルトは真です。
: :object_class
JSON のオブジェクトを変換するクラスを指定します。デフォルトは Hash です。
: :array_class
JSON の配列を変換するクラスを指定します。デフォルトは Array です。

@param source パーサ...
...ます。

@param options オプションを指定するためのハッシュです。

//emlist[例][ruby]{
require 'json'

parse
r = JSON::Parser.new(DATA.read)
print parser.source

# => {
# => "Tanaka": {
# => "name":"tanaka",
# => "age":20
# => },
# => "Suzuki": {
# => "name":"s...
...rson
attr_accessor :name, :age

def []=(key, value)
instance_variable_set("@#{key}", value)
end
end

parse
r = JSON::Parser.new(DATA.read, object_class: Person)
person = parser.parse
person.class # => Person
person.name # => "tanaka"
person.age # => 20

__END__
{
"name":"tanaka",
"ag...

CSV.new(data, options = Hash.new) -> CSV (114.0)

このメソッドは CSV ファイルを読み込んだり、書き出したりするために String か IO のインスタンスをラップします。

...medCSVError, assuming the data is faulty. You can use this limit to
prevent what are effectively DoS attacks on the parser. However, this
limit can cause a legitimate parse to fail and thus is set to +nil+, or off,
by default.
: :converters
CSV::Converters から取り出した名前の...
...一行目をヘッダとして扱います。
配列を指定するとそれをヘッダとして扱います。文字列を指定すると CSV.parse_line を
使用してパースした結果をヘッダとして扱います。このとき、:col_sep, :row_sep, :quote_char
はこのインス...

JSON.[](object, options) -> object (37.0)

文字列のように扱えるデータを受け取った場合は Ruby のオブジェクトに変換して返します。 そうでない場合は JSON に変換して返します。

...定可能です。

@param options JSON.#parse, JSON.#generate の説明を参照してください。

//emlist[例][ruby]{
require "json"
string=<<JSON
{ "a":1, "b":2, "c":3 }
JSON
hash
= { a: 1, b: 2, c: 3 }

JSON[string].class # => Hash
JSON[string] # =>...
...{"a"=>1, "b"=>2, "c"=>3}
JSON[string, symbolize_names: true] # => {:a=>1, :b=>2, :c=>3}
JSON[hash].class # => String
JSON[hash] # => "{\"a\":1,\"b\":2,\"c\":3}"
//}

@see JSON.#parse, JSON.#generate...

OpenURI.open_uri(name, mode = &#39;r&#39;, perm = nil, options = {}) -> StringIO (19.0)

URI である文字列 name のリソースを取得して StringIO オブジェクト として返します。

...n_uri('http://www.example.com')
p sio.last_modified
puts sio.read

OpenURI.open_uri('http://www.example.com'){|sio| sio.read }

options には Hash を与えます。理解するハッシュの
キーは以下のシンボル、
* :proxy
* :progress_proc
* :content_length_proc
* :http_basic...
...えます。
//emlist{
文字列: "http://proxy.example.com:8000/" のようなプロクシの URI。
URI オブジェクト: URI.parse("http://proxy.example.com:8000/") のようなプロクシの URI オブジェクト。
true: Proxy を環境変数などから見つ...
...tp_basic_authentication =>
["http://proxy.example.com:8000/", "proxy-user", "proxy-password"]
:proxy_http_basic_authentication =>
[URI.parse("http://proxy.example.com:8000/"), "proxy-user", "proxy-password"]
//}

: :read_timeout
http コネクションのタイムアウト秒数を指...

OpenURI.open_uri(name, mode = &#39;r&#39;, perm = nil, options = {}) {|sio| ... } -> nil (19.0)

URI である文字列 name のリソースを取得して StringIO オブジェクト として返します。

...n_uri('http://www.example.com')
p sio.last_modified
puts sio.read

OpenURI.open_uri('http://www.example.com'){|sio| sio.read }

options には Hash を与えます。理解するハッシュの
キーは以下のシンボル、
* :proxy
* :progress_proc
* :content_length_proc
* :http_basic...
...えます。
//emlist{
文字列: "http://proxy.example.com:8000/" のようなプロクシの URI。
URI オブジェクト: URI.parse("http://proxy.example.com:8000/") のようなプロクシの URI オブジェクト。
true: Proxy を環境変数などから見つ...
...tp_basic_authentication =>
["http://proxy.example.com:8000/", "proxy-user", "proxy-password"]
:proxy_http_basic_authentication =>
[URI.parse("http://proxy.example.com:8000/"), "proxy-user", "proxy-password"]
//}

: :read_timeout
http コネクションのタイムアウト秒数を指...

絞り込み条件を変える

<< < 1 2 >>