Class: DdbRuby::FifthEdition::ClassClassFeature
- Inherits:
-
Dry::Struct
- Object
- Dry::Struct
- DdbRuby::FifthEdition::ClassClassFeature
- Defined in:
- lib/ddb_ruby/fifth_edition/structs.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.from_dynamic!(d) ⇒ Object
2163 2164 2165 2166 2167 2168 2169 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 2163 def self.from_dynamic!(d) d = Types::Hash[d] new( definition: ClassFeatureDefinition.from_dynamic!(d.fetch("definition")), level_scale: d.fetch("levelScale") ? LevelScale.from_dynamic!(d.fetch("levelScale")) : nil, ) end |
.from_json!(json) ⇒ Object
2171 2172 2173 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 2171 def self.from_json!(json) from_dynamic!(JSON.parse(json)) end |
Instance Method Details
#to_dynamic ⇒ Object
2175 2176 2177 2178 2179 2180 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 2175 def to_dynamic { "definition" => definition.to_dynamic, "levelScale" => level_scale&.to_dynamic, } end |
#to_json(options = nil) ⇒ Object
2182 2183 2184 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 2182 def to_json( = nil) JSON.generate(to_dynamic, ) end |