Class: DdbRuby::FifthEdition::SavingThrow
- Inherits:
-
Dry::Struct
- Object
- Dry::Struct
- DdbRuby::FifthEdition::SavingThrow
- Defined in:
- lib/ddb_ruby/fifth_edition/structs.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.from_dynamic!(d) ⇒ Object
2600 2601 2602 2603 2604 2605 2606 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 2600 def self.from_dynamic!(d) d = Types::Hash[d] new( stat_id: d.fetch("statId"), bonus_modifier: d.fetch("bonusModifier"), ) end |
.from_json!(json) ⇒ Object
2608 2609 2610 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 2608 def self.from_json!(json) from_dynamic!(JSON.parse(json)) end |
Instance Method Details
#to_dynamic ⇒ Object
2612 2613 2614 2615 2616 2617 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 2612 def to_dynamic { "statId" => stat_id, "bonusModifier" => bonus_modifier, } end |
#to_json(options = nil) ⇒ Object
2619 2620 2621 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 2619 def to_json( = nil) JSON.generate(to_dynamic, ) end |