Class: DdbRuby::FifthEdition::FeatList
- Inherits:
-
Dry::Struct
- Object
- Dry::Struct
- DdbRuby::FifthEdition::FeatList
- Defined in:
- lib/ddb_ruby/fifth_edition/structs.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.from_dynamic!(d) ⇒ Object
444 445 446 447 448 449 450 451 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 444 def self.from_dynamic!(d) d = Types::Hash[d] new( id: d.fetch("id"), feat_list_name: d.fetch("name"), feat_ids: d.fetch("featIds"), ) end |
.from_json!(json) ⇒ Object
453 454 455 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 453 def self.from_json!(json) from_dynamic!(JSON.parse(json)) end |
Instance Method Details
#to_dynamic ⇒ Object
457 458 459 460 461 462 463 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 457 def to_dynamic { "id" => id, "name" => feat_list_name, "featIds" => feat_ids, } end |
#to_json(options = nil) ⇒ Object
465 466 467 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 465 def to_json( = nil) JSON.generate(to_dynamic, ) end |