るりまサーチ

最速Rubyリファレンスマニュアル検索!
72件ヒット [1-72件を表示] (0.087秒)
トップページ > クエリ:object[x] > クエリ:>[x] > クエリ:attr[x] > 種類:特異メソッド[x]

別のキーワード

  1. objectspace each_object
  2. _builtin each_object
  3. object send
  4. object enum_for
  5. object to_enum

ライブラリ

モジュール

キーワード

検索結果

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">
//}...