Class: Email
- Inherits:
-
Dry::Struct
- Object
- Dry::Struct
- Defined in:
- lib/schemas.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.from_dynamic!(d) ⇒ Object
1506 1507 1508 1509 1510 1511 |
# File 'lib/schemas.rb', line 1506 def self.from_dynamic!(d) d = Types::Hash[d] new( email: d.fetch("email"), ) end |
.from_json!(json) ⇒ Object
1513 1514 1515 |
# File 'lib/schemas.rb', line 1513 def self.from_json!(json) from_dynamic!(JSON.parse(json)) end |
Instance Method Details
#to_dynamic ⇒ Object
1517 1518 1519 1520 1521 |
# File 'lib/schemas.rb', line 1517 def to_dynamic { "email" => email, } end |
#to_json(options = nil) ⇒ Object
1523 1524 1525 |
# File 'lib/schemas.rb', line 1523 def to_json( = nil) JSON.generate(to_dynamic, ) end |