-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
module Hearth | ||
# A module mixed into Structs that provides utility methods. | ||
module Structure | ||
# Deeply converts the Struct into a hash. Structure members that | ||
# are `nil` are omitted from the resultant hash. | ||
# | ||
# @return [Hash] | ||
def to_h: (?untyped obj) -> untyped | ||
|
||
alias to_hash to_h | ||
|
||
private | ||
|
||
def _to_h_struct: (untyped obj) -> untyped | ||
|
||
def _to_h_hash: (untyped obj) -> untyped | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module Hearth | ||
# Top level class for all Union types | ||
class Union < ::SimpleDelegator | ||
include Hearth::Structure | ||
end | ||
end |