Class: DdbRuby::FifthEdition::Notes
- Inherits:
-
Dry::Struct
- Object
- Dry::Struct
- DdbRuby::FifthEdition::Notes
- Defined in:
- lib/ddb_ruby/fifth_edition/structs.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.from_dynamic!(d) ⇒ Object
3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 3734 def self.from_dynamic!(d) d = Types::Hash[d] new( allies: d.fetch("allies"), personal_possessions: d.fetch("personalPossessions"), other_holdings: d.fetch("otherHoldings"), organizations: d.fetch("organizations"), enemies: d.fetch("enemies"), backstory: d.fetch("backstory"), other_notes: d.fetch("otherNotes"), ) end |
.from_json!(json) ⇒ Object
3747 3748 3749 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 3747 def self.from_json!(json) from_dynamic!(JSON.parse(json)) end |
Instance Method Details
#to_dynamic ⇒ Object
3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 3751 def to_dynamic { "allies" => allies, "personalPossessions" => personal_possessions, "otherHoldings" => other_holdings, "organizations" => organizations, "enemies" => enemies, "backstory" => backstory, "otherNotes" => other_notes, } end |
#to_json(options = nil) ⇒ Object
3763 3764 3765 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 3763 def to_json( = nil) JSON.generate(to_dynamic, ) end |