Class: DdbRuby::FifthEdition::Preferences
- Inherits:
-
Dry::Struct
- Object
- Dry::Struct
- DdbRuby::FifthEdition::Preferences
- Defined in:
- lib/ddb_ruby/fifth_edition/structs.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.from_dynamic!(d) ⇒ Object
3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 3819 def self.from_dynamic!(d) d = Types::Hash[d] new( use_homebrew_content: d.fetch("useHomebrewContent"), progression_type: d.fetch("progressionType"), encumbrance_type: d.fetch("encumbranceType"), ignore_coin_weight: d.fetch("ignoreCoinWeight"), hit_point_type: d.fetch("hitPointType"), show_unarmed_strike: d.fetch("showUnarmedStrike"), show_scaled_spells: d.fetch("showScaledSpells"), primary_sense: d.fetch("primarySense"), primary_movement: d.fetch("primaryMovement"), privacy_type: d.fetch("privacyType"), sharing_type: d.fetch("sharingType"), ability_score_display_type: d.fetch("abilityScoreDisplayType"), enforce_feat_rules: d.fetch("enforceFeatRules"), enforce_multiclass_rules: d.fetch("enforceMulticlassRules"), enable_optional_class_features: d.fetch("enableOptionalClassFeatures"), enable_optional_origins: d.fetch("enableOptionalOrigins"), enable_dark_mode: d.fetch("enableDarkMode"), enable_container_currency: d.fetch("enableContainerCurrency"), ) end |
.from_json!(json) ⇒ Object
3843 3844 3845 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 3843 def self.from_json!(json) from_dynamic!(JSON.parse(json)) end |
Instance Method Details
#to_dynamic ⇒ Object
3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 3847 def to_dynamic { "useHomebrewContent" => use_homebrew_content, "progressionType" => progression_type, "encumbranceType" => encumbrance_type, "ignoreCoinWeight" => ignore_coin_weight, "hitPointType" => hit_point_type, "showUnarmedStrike" => show_unarmed_strike, "showScaledSpells" => show_scaled_spells, "primarySense" => primary_sense, "primaryMovement" => primary_movement, "privacyType" => privacy_type, "sharingType" => sharing_type, "abilityScoreDisplayType" => ability_score_display_type, "enforceFeatRules" => enforce_feat_rules, "enforceMulticlassRules" => enforce_multiclass_rules, "enableOptionalClassFeatures" => enable_optional_class_features, "enableOptionalOrigins" => enable_optional_origins, "enableDarkMode" => enable_dark_mode, "enableContainerCurrency" => enable_container_currency, } end |
#to_json(options = nil) ⇒ Object
3870 3871 3872 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 3870 def to_json( = nil) JSON.generate(to_dynamic, ) end |