Class: DdbRuby::FifthEdition::DefinitionClassFeature
- Inherits:
-
Dry::Struct
- Object
- Dry::Struct
- DdbRuby::FifthEdition::DefinitionClassFeature
- Defined in:
- lib/ddb_ruby/fifth_edition/structs.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.from_dynamic!(d) ⇒ Object
2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 2195 def self.from_dynamic!(d) d = Types::Hash[d] new( id: d.fetch("id"), class_feature_name: d.fetch("name"), prerequisite: d.fetch("prerequisite"), description: d.fetch("description"), required_level: d.fetch("requiredLevel"), display_order: d.fetch("displayOrder"), ) end |
.from_json!(json) ⇒ Object
2207 2208 2209 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 2207 def self.from_json!(json) from_dynamic!(JSON.parse(json)) end |
Instance Method Details
#to_dynamic ⇒ Object
2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 2211 def to_dynamic { "id" => id, "name" => class_feature_name, "prerequisite" => prerequisite, "description" => description, "requiredLevel" => required_level, "displayOrder" => display_order, } end |
#to_json(options = nil) ⇒ Object
2222 2223 2224 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 2222 def to_json( = nil) JSON.generate(to_dynamic, ) end |