-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(alba): Handle inline associations
Introducing `InlineType` class for handling inline associations. This commit also adds `require "logger"` to avoid an error with console.
- Loading branch information
1 parent
5284071
commit 13d603e
Showing
6 changed files
with
36 additions
and
4 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
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
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
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,22 @@ | ||
module Typelizer | ||
# InlineType is mainly used with Alba plugin to represent inline associations. | ||
# `name `method` is the same interface as `Interface` class. | ||
class InlineType | ||
TEMPLATE = <<~ERB.strip | ||
{ | ||
<%- properties.each do |property| %> | ||
<%= property %>; | ||
<% end %> | ||
} | ||
ERB | ||
def initialize(serializer:, config:) | ||
@serializer = serializer | ||
@config = config | ||
end | ||
|
||
def name | ||
properties = SerializerPlugins::Alba.new(serializer: @serializer, config: @config).properties | ||
ERB.new(TEMPLATE, trim_mode: "-").result_with_hash(properties: properties) | ||
end | ||
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
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