Class: DdbRuby::FifthEdition::Skill
- Inherits:
-
Dry::Struct
- Object
- Dry::Struct
- DdbRuby::FifthEdition::Skill
- Defined in:
- lib/ddb_ruby/fifth_edition/structs.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.from_dynamic!(d) ⇒ Object
2657 2658 2659 2660 2661 2662 2663 2664 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 2657 def self.from_dynamic!(d) d = Types::Hash[d] new( skill_id: d.fetch("skillId"), value: d.fetch("value"), additional_bonus: d.fetch("additionalBonus"), ) end |
.from_json!(json) ⇒ Object
2666 2667 2668 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 2666 def self.from_json!(json) from_dynamic!(JSON.parse(json)) end |
Instance Method Details
#to_dynamic ⇒ Object
2670 2671 2672 2673 2674 2675 2676 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 2670 def to_dynamic { "skillId" => skill_id, "value" => value, "additionalBonus" => additional_bonus, } end |
#to_json(options = nil) ⇒ Object
2678 2679 2680 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 2678 def to_json( = nil) JSON.generate(to_dynamic, ) end |