Class: DdbRuby::FifthEdition::InfusionRule
- Inherits:
-
Dry::Struct
- Object
- Dry::Struct
- DdbRuby::FifthEdition::InfusionRule
- Defined in:
- lib/ddb_ruby/fifth_edition/structs.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.from_dynamic!(d) ⇒ Object
1958 1959 1960 1961 1962 1963 1964 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 1958 def self.from_dynamic!(d) d = Types::Hash[d] new( level: d.fetch("level"), choice_key: d.fetch("choiceKey"), ) end |
.from_json!(json) ⇒ Object
1966 1967 1968 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 1966 def self.from_json!(json) from_dynamic!(JSON.parse(json)) end |
Instance Method Details
#to_dynamic ⇒ Object
1970 1971 1972 1973 1974 1975 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 1970 def to_dynamic { "level" => level, "choiceKey" => choice_key, } end |
#to_json(options = nil) ⇒ Object
1977 1978 1979 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 1977 def to_json( = nil) JSON.generate(to_dynamic, ) end |