Skip to content

Commit

Permalink
refactor: Add return type to builder methods (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
stephannv authored Apr 19, 2023
1 parent 729a9d7 commit e61e536
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions src/blueprint/html/builder.cr
Original file line number Diff line number Diff line change
@@ -1,27 +1,23 @@
module Blueprint::HTML
# EXPERIMENTAL
def self.build(&)
Builder.build do |builder|
with builder yield
end
def self.build(&) : String
Builder.build { |builder| with builder yield }
end

private struct Builder
include Blueprint::HTML

def self.build(&)
def self.build(&) : String
builder = new
builder.build do
yield builder
end
builder.build { yield builder }
end

private def blueprint(&)
yield
def build(&) : String
to_html { with self yield }
end

protected def build(&)
to_html { with self yield }
private def blueprint(&) : Nil
yield
end
end
end

0 comments on commit e61e536

Please sign in to comment.