Class: DdbRuby::FifthEdition::Range1
- Inherits:
-
Dry::Struct
- Object
- Dry::Struct
- DdbRuby::FifthEdition::Range1
- Defined in:
- lib/ddb_ruby/fifth_edition/structs.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.from_dynamic!(d) ⇒ Object
176 177 178 179 180 181 182 183 184 185 186 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 176 def self.from_dynamic!(d) d = Types::Hash[d] new( range: d.fetch("range"), long_range: d.fetch("longRange"), aoe_type: d.fetch("aoeType"), aoe_size: d.fetch("aoeSize"), has_aoe_special_description: d.fetch("hasAoeSpecialDescription"), minimum_range: d.fetch("minimumRange"), ) end |
.from_json!(json) ⇒ Object
188 189 190 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 188 def self.from_json!(json) from_dynamic!(JSON.parse(json)) end |
Instance Method Details
#to_dynamic ⇒ Object
192 193 194 195 196 197 198 199 200 201 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 192 def to_dynamic { "range" => range, "longRange" => long_range, "aoeType" => aoe_type, "aoeSize" => aoe_size, "hasAoeSpecialDescription" => has_aoe_special_description, "minimumRange" => minimum_range, } end |
#to_json(options = nil) ⇒ Object
203 204 205 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 203 def to_json( = nil) JSON.generate(to_dynamic, ) end |