-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Reorganize more code (#62)
- Loading branch information
Showing
8 changed files
with
54 additions
and
49 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
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,23 @@ | ||
module Blueprint::HTML::Renderer | ||
def render_to(buffer : String::Builder) : Nil | ||
return unless render? | ||
|
||
@buffer = buffer | ||
|
||
envelope { blueprint } | ||
end | ||
|
||
def render_to(buffer : String::Builder, &) : Nil | ||
return unless render? | ||
|
||
@buffer = buffer | ||
|
||
envelope do | ||
blueprint { render_block { yield } } | ||
end | ||
end | ||
|
||
private def render? : Bool | ||
true | ||
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 |
---|---|---|
@@ -1,13 +1,13 @@ | ||
require "../svg/component" | ||
|
||
module Blueprint::HTML::SVG | ||
private def svg(**attributes) : Nil | ||
svg(**attributes) { } | ||
end | ||
|
||
private def svg(**attributes, &) : Nil | ||
render Blueprint::SVG::Component.new(**attributes) do |component| | ||
with component yield | ||
end | ||
end | ||
|
||
private def svg(**attributes) : Nil | ||
render Blueprint::SVG::Component.new(**attributes) | ||
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