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
2144 2145 2146 2147 2148 2149 2150 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 2144 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
2152 2153 2154 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 2152 def self.from_json!(json) from_dynamic!(JSON.parse(json)) end |
Instance Method Details
#to_dynamic ⇒ Object
2156 2157 2158 2159 2160 2161 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 2156 def to_dynamic { "definition" => definition.to_dynamic, "levelScale" => level_scale&.to_dynamic, } end |
#to_json(options = nil) ⇒ Object
2163 2164 2165 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 2163 def to_json( = nil) JSON.generate(to_dynamic, ) end |