Class: DdbRuby::FifthEdition::PactMagic
- Inherits:
-
Dry::Struct
- Object
- Dry::Struct
- DdbRuby::FifthEdition::PactMagic
- Defined in:
- lib/ddb_ruby/fifth_edition/structs.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.from_dynamic!(d) ⇒ Object
3773 3774 3775 3776 3777 3778 3779 3780 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 3773 def self.from_dynamic!(d) d = Types::Hash[d] new( level: d.fetch("level"), used: d.fetch("used"), available: d.fetch("available"), ) end |
.from_json!(json) ⇒ Object
3782 3783 3784 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 3782 def self.from_json!(json) from_dynamic!(JSON.parse(json)) end |
Instance Method Details
#to_dynamic ⇒ Object
3786 3787 3788 3789 3790 3791 3792 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 3786 def to_dynamic { "level" => level, "used" => used, "available" => available, } end |
#to_json(options = nil) ⇒ Object
3794 3795 3796 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 3794 def to_json( = nil) JSON.generate(to_dynamic, ) end |