Class: DdbRuby::FifthEdition::DisplayConfiguration
- Inherits:
-
Dry::Struct
- Object
- Dry::Struct
- DdbRuby::FifthEdition::DisplayConfiguration
- Defined in:
- lib/ddb_ruby/fifth_edition/structs.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.from_dynamic!(d) ⇒ Object
1921 1922 1923 1924 1925 1926 1927 1928 1929 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 1921 def self.from_dynamic!(d) d = Types::Hash[d] new( racialtrait: d.fetch("RACIALTRAIT"), language: d.fetch("LANGUAGE"), abilityscore: d.fetch("ABILITYSCORE"), classfeature: d.fetch("CLASSFEATURE"), ) end |
.from_json!(json) ⇒ Object
1931 1932 1933 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 1931 def self.from_json!(json) from_dynamic!(JSON.parse(json)) end |
Instance Method Details
#to_dynamic ⇒ Object
1935 1936 1937 1938 1939 1940 1941 1942 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 1935 def to_dynamic { "RACIALTRAIT" => racialtrait, "LANGUAGE" => language, "ABILITYSCORE" => abilityscore, "CLASSFEATURE" => classfeature, } end |
#to_json(options = nil) ⇒ Object
1944 1945 1946 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 1944 def to_json( = nil) JSON.generate(to_dynamic, ) end |