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
3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 3444 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
3455 3456 3457 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 3455 def self.from_json!(json) from_dynamic!(JSON.parse(json)) end |
Instance Method Details
#to_dynamic ⇒ Object
3459 3460 3461 3462 3463 3464 3465 3466 3467 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 3459 def to_dynamic { "walk" => walk, "fly" => fly, "burrow" => burrow, "swim" => swim, "climb" => climb, } end |
#to_json(options = nil) ⇒ Object
3469 3470 3471 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 3469 def to_json( = nil) JSON.generate(to_dynamic, ) end |