Class: DdbRuby::FifthEdition::ThemeColor
- Inherits:
-
Dry::Struct
- Object
- Dry::Struct
- DdbRuby::FifthEdition::ThemeColor
- Defined in:
- lib/ddb_ruby/fifth_edition/structs.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.from_dynamic!(d) ⇒ Object
3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 3082 def self.from_dynamic!(d) d = Types::Hash[d] new( theme_color_id: d.fetch("themeColorId"), theme_color: d.fetch("themeColor"), background_color: d.fetch("backgroundColor"), theme_color_name: d.fetch("name"), race_id: d.fetch("raceId"), sub_race_id: d.fetch("subRaceId"), class_id: d.fetch("classId"), tags: d.fetch("tags"), decoration_key: d.fetch("decorationKey"), ) end |
.from_json!(json) ⇒ Object
3097 3098 3099 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 3097 def self.from_json!(json) from_dynamic!(JSON.parse(json)) end |
Instance Method Details
#to_dynamic ⇒ Object
3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 3101 def to_dynamic { "themeColorId" => theme_color_id, "themeColor" => theme_color, "backgroundColor" => background_color, "name" => theme_color_name, "raceId" => race_id, "subRaceId" => sub_race_id, "classId" => class_id, "tags" => , "decorationKey" => decoration_key, } end |
#to_json(options = nil) ⇒ Object
3115 3116 3117 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 3115 def to_json( = nil) JSON.generate(to_dynamic, ) end |