78件ヒット
[1-78件を表示]
(0.024秒)
ライブラリ
- json (48)
-
rubygems
/ requirement (12)
クラス
-
Gem
:: Requirement (12) -
JSON
:: Parser (12)
モジュール
- JSON (36)
キーワード
-
NEWS for Ruby 2
. 7 . 0 (6) -
create
_ id (12) - new (24)
- parse! (12)
-
ruby 1
. 8 . 4 feature (12)
検索結果
先頭5件
-
JSON
. # parse(source , options = {}) -> object (18131.0) -
与えられた JSON 形式の文字列を Ruby オブジェクトに変換して返します。
...JSON::Infinity,
JSON::MinusInfinity を許可するようになります。デフォルトは偽です。
: :create_additions
偽を指定するとマッチするクラスや JSON.create_id が見つかっても付加情報を生成しません。
デフォルトは偽です。
: :symbolize_na......フォルトは偽です。
//emlist[例][ruby]{
require "json"
JSON.parse('[1,2,{"name":"tanaka","age":19}]')
# => [1, 2, {"name"=>"tanaka", "age"=>19}]
JSON.parse('[1,2,{"name":"tanaka","age":19}]', symbolize_names: true)
# => [1, 2, {:name=>"tanaka", :age=>19}]
//}
@see JSON::Parser#parse... -
JSON
. # parse!(source , options = {}) -> object (6143.0) -
与えられた JSON 形式の文字列を Ruby オブジェクトに変換して返します。
...与えられた JSON 形式の文字列を Ruby オブジェクトに変換して返します。
JSON.#parse よりも危険なデフォルト値が指定されているので
信頼できる文字列のみを入力として使用するようにしてください。
@param source JSON 形式の......す。
: :create_additions
偽を指定するとマッチするクラスや JSON.create_id が見つかっても付加情報を生成しません。
デフォルトは偽です。
//emlist[例][ruby]{
require "json"
json_text = "[1,2,{\"name\":\"tanaka\",\"age\":19}, NaN]"
JSON.parse!(json_tex......t)
# => [1, 2, {"name"=>"tanaka", "age"=>19}, NaN]
JSON.parse!(json_text, symbolize_names: true)
# => [1, 2, {:name=>"tanaka", :age=>19}, NaN]
JSON.parse(json_text) # => unexpected token at 'NaN]' (JSON::ParserError)
//}
@see JSON::Parser#parse... -
JSON
. create _ id -> String (6141.0) -
json_create メソッドで使用するクラスを決定するために使用する値を返します。
...son_create メソッドで使用するクラスを決定するために使用する値を返します。
デフォルトは "json_class" です。
//emlist[例][ruby]{
require "json"
class User
attr :id, :name
def initialize(id, name)
@id, @name = id, name
end
def self.json_create(ob......{
JSON.create_id => self.class.name,
"id" => id,
"name" => name,
}
end
def to_json(*)
as_json.to_json
end
end
json = JSON.generate(User.new(1, "tanaka"))
json # => "{\"json_class\":\"User\",\"id\":1,\"name\":\"tanaka\"}"
JSON.parse(json, create_additions: true)... -
JSON
:: Parser . new(source , options => {}) -> JSON :: Parser (3112.0) -
パーサを初期化します。
...真を指定すると 4627 を無視して NaN, Infinity, -Infinity をパースエラーにしません。
デフォルトは偽です。
: :create_additions
偽を指定するとマッチするクラスや ID があっても付加情報を生成しません。デフォルトは真です。......ます。
@param options オプションを指定するためのハッシュです。
//emlist[例][ruby]{
require 'json'
parser = 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
parser = JSON::Parser.new(DATA.read, object_class: Person)
person = parser.parse
person.class # => Person
person.name # => "tanaka"
person.age # => 20
__END__
{
"name":"tanaka",
"ag... -
ruby 1
. 8 . 4 feature (60.0) -
ruby 1.8.4 feature ruby 1.8.4 での ruby 1.8.3 からの変更点です。
...t]>))
* ((<ruby 1.8.4 feature/TCPSocket#initialize [bug]>))
* ((<ruby 1.8.4 feature/TCPServer#initialize [bug]>))
* ((<ruby 1.8.4 feature/"optparse">))
* ((<ruby 1.8.4 feature/"find">))
* ((<ruby 1.8.4 feature/Iconv>))
* ((<ruby 1.8.4 feature/WEBrick::Config::FileHandler [compat]>))
*.......8.4 feature/BeOS [bug]>))
* ((<ruby 1.8.4 feature/Sun [bug]>))
* ((<ruby 1.8.4 feature/IA64 [bug]>))
== Ruby本体
: Symbol [bug]
# * parse.y (dsym): prohibit empty symbol literal by interpolation.
# fixed: [ruby-talk:166529]
式展開で空のSymbolを作ることがで......xt.c (MakeX509ExtFactory): should use
# OPENSSL_malloc to allocate X509V3_CTX.
#
# * ext/openssl/ossl_x509ext.c (ossl_x509extfactory_create_ext): use
# X509V3_EXT_nconf_nid to avoid SEGV (and to build extensions which
# values are placed in separate section).
#
#... -
NEWS for Ruby 2
. 7 . 0 (30.0) -
NEWS for Ruby 2.7.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...ame": "Alice",
"age": 30,
"children": [{ "name": "Bob", "age": 2 }]
}
END
JSON.parse(json, symbolize_names: true) in {name: "Alice", children: [{name: name, age: age}]}
p name #=> "Bob"
p age #=> 2
JSON.parse(json, symbolize_names: true) in {name: "Alice", children: [{name: "Charlie", age: a......で呼び出すと
例外が発生するようになりました。
//emlist[][ruby]{
def bar
lambda
end
bar { puts "Hello" } #=> tried to create Proc object without a block (ArgumentError)
//}
==== その他の変更
* 始端なしRangeが実験的に導入されました。
caseやC......が単一の代入と同じ振る舞いになりました。 8279
//emlist[][ruby]{
a, b = raise rescue [1, 2]
# Previously parsed as: (a, b = raise) rescue [1, 2]
# Now parsed as: a, b = (raise rescue [1, 2])
//}
* 特異クラス構文での yield は警告を表示するようにな... -
Gem
:: Requirement . new(requirements) -> Gem :: Requirement (12.0) -
Gem::Requirement のインスタンスを作成します。
...ent のインスタンスを作成します。
@param requirements 文字列か配列か Gem::Version のインスタンスを指定します。
//emlist[][ruby]{
pp Gem::Requirement.new("~> 3.2.1")
# => Gem::Requirement.new(["~> 3.2.1"])
//}
@see Gem::Requirement#parse, Gem::Requirement.create...