Class: DdbRuby::FifthEdition::Normal
- Inherits:
-
Dry::Struct
- Object
- Dry::Struct
- DdbRuby::FifthEdition::Normal
- Defined in:
- lib/ddb_ruby/fifth_edition/structs.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.from_dynamic!(d) ⇒ Object
3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 3564 def self.from_dynamic!(d) d = Types::Hash[d] new( walk: d.fetch("walk"), fly: d.fetch("fly"), burrow: d.fetch("burrow"), swim: d.fetch("swim"), climb: d.fetch("climb"), ) end |
.from_json!(json) ⇒ Object
3575 3576 3577 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 3575 def self.from_json!(json) from_dynamic!(JSON.parse(json)) end |
Instance Method Details
#to_dynamic ⇒ Object
3579 3580 3581 3582 3583 3584 3585 3586 3587 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 3579 def to_dynamic { "walk" => walk, "fly" => fly, "burrow" => burrow, "swim" => swim, "climb" => climb, } end |
#to_json(options = nil) ⇒ Object
3589 3590 3591 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 3589 def to_json( = nil) JSON.generate(to_dynamic, ) end |