Class: DdbRuby::FifthEdition::LimitedUseElement
- Inherits:
-
Dry::Struct
- Object
- Dry::Struct
- DdbRuby::FifthEdition::LimitedUseElement
- Defined in:
- lib/ddb_ruby/fifth_edition/structs.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.from_dynamic!(d) ⇒ Object
2023 2024 2025 2026 2027 2028 2029 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 2023 def self.from_dynamic!(d) d = Types::Hash[d] new( level: d.fetch("level"), uses: d.fetch("uses"), ) end |
.from_json!(json) ⇒ Object
2031 2032 2033 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 2031 def self.from_json!(json) from_dynamic!(JSON.parse(json)) end |
Instance Method Details
#to_dynamic ⇒ Object
2035 2036 2037 2038 2039 2040 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 2035 def to_dynamic { "level" => level, "uses" => uses, } end |
#to_json(options = nil) ⇒ Object
2042 2043 2044 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 2042 def to_json( = nil) JSON.generate(to_dynamic, ) end |