72件ヒット
[1-72件を表示]
(0.087秒)
ライブラリ
- json (24)
- openssl (24)
- psych (12)
-
rubygems
/ specification (12)
クラス
-
Gem
:: Specification (12) -
JSON
:: Parser (12) - Object (12)
-
OpenSSL
:: X509 :: Attribute (24)
モジュール
- JSON (12)
キーワード
-
array
_ attributes (12) -
create
_ id (12) - new (36)
-
yaml
_ tag (12)
検索結果
先頭5件
-
Object
. yaml _ tag(tag) -> () (9149.0) -
クラスと tag の間を関連付けます。
...end
attr_reader :x
end
# Dumps Ruby object normally
p Psych.dump(Foo.new(3))
# =>
# --- !ruby/object:Foo
# x: 3
# Registers tag with class Foo
Foo.yaml_as("tag:example.com,2013:foo")
# ... and dumps the object of Foo class
Psych.dump(Foo.new(3), STDOUT)
# =>......# --- !<tag:example.com,2013:foo>
# x: 3
# Loads the object from the tagged YAML node
p Psych.load(<<EOS)
--- !<tag:example.com,2012:foo>
x: 8
EOS
# => #<Foo:0x0000000130f48 @x=8>... -
Gem
:: Specification . array _ attributes -> Array (6207.0) -
@@array_attributes の複製を返します。
...@@array_attributes の複製を返します。
@see Object#dup... -
OpenSSL
:: X509 :: Attribute . new(der) -> OpenSSL :: X509 :: Attribute (3219.0) -
attribute オブジェクトを生成します。
...attribute オブジェクトを生成します。
引数が1個で、文字列であるならば、それを DER 形式の
データであると見なして attribute オブジェクトを生成します。
引数が1個で、それ以外の場合は to_der メソッドで DER 形式に変換して......から
それを attribute オブジェクトに変換します。
引数が2個の場合は、それぞれを attribute の Object ID (識別子)と
値(内容)と見なして attribute オブジェクトを生成します。
この場合、oid は Object ID の文字列、value には
OpenSSL::AS......r DER 形式の文字列、もしくは to_der を持つオブジェクト
@param oid Object ID 文字列
@param value 値を表す OpenSSL::ASN1::ASN1Data インスタンス
@raise OpenSSL::X509::AttributeError attributeオブジェクトの生成に失敗した場合に
発生します。DE... -
OpenSSL
:: X509 :: Attribute . new(oid , value) -> OpenSSL :: X509 :: Attribute (3219.0) -
attribute オブジェクトを生成します。
...attribute オブジェクトを生成します。
引数が1個で、文字列であるならば、それを DER 形式の
データであると見なして attribute オブジェクトを生成します。
引数が1個で、それ以外の場合は to_der メソッドで DER 形式に変換して......から
それを attribute オブジェクトに変換します。
引数が2個の場合は、それぞれを attribute の Object ID (識別子)と
値(内容)と見なして attribute オブジェクトを生成します。
この場合、oid は Object ID の文字列、value には
OpenSSL::AS......r DER 形式の文字列、もしくは to_der を持つオブジェクト
@param oid Object ID 文字列
@param value 値を表す OpenSSL::ASN1::ASN1Data インスタンス
@raise OpenSSL::X509::AttributeError attributeオブジェクトの生成に失敗した場合に
発生します。DE... -
JSON
:: Parser . new(source , options => {}) -> JSON :: Parser (225.0) -
パーサを初期化します。
...ditions
偽を指定するとマッチするクラスや ID があっても付加情報を生成しません。デフォルトは真です。
: :object_class
JSON のオブジェクトを変換するクラスを指定します。デフォルトは Hash です。
: :array_class
JSON の配列......=> {
# => "Tanaka": {
# => "name":"tanaka",
# => "age":20
# => },
# => "Suzuki": {
# => "name":"suzuki",
# => "age":25
# => }
# => }
__END__
{
"Tanaka": {
"name":"tanaka",
"age":20
},
"Suzuki": {
"name":"suzuki",
"age":25
}
}
//}
//emlist[例 object_......e 'json'
class Person
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__
{
"nam... -
JSON
. create _ id -> String (125.0) -
json_create メソッドで使用するクラスを決定するために使用する値を返します。
...quire "json"
class User
attr :id, :name
def initialize(id, name)
@id, @name = id, name
end
def self.json_create(object)
new(object['id'], object["name"])
end
def as_json(*)
{
JSON.create_id => self.class.name,
"id" => id,
"name" => name,
}
end
de......f 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)
# => #<User:0x0000557709b269e0 @id=1, @name="tanaka">
//}...