diff --git a/README.md b/README.md
index 1787520..45d8a2b 100644
--- a/README.md
+++ b/README.md
@@ -36,7 +36,7 @@ class Alert
end
end
-Alert.new.to_html
+Alert.new.to_s
```
Output:
diff --git a/benchmark/benchmark.cr b/benchmark/benchmark.cr
index 736ef7d..8f6baca 100644
--- a/benchmark/benchmark.cr
+++ b/benchmark/benchmark.cr
@@ -6,14 +6,14 @@ require "./ecr"
require "../src/blueprint/version"
-blueprint_html = BlueprintHTML::Page.new.to_html
-blueprint_raw_html = BlueprintRawHTML::Page.new.to_html
+blueprint_html = BlueprintHTML::Page.new.to_s
+blueprint_raw_html = BlueprintRawHTML::Page.new.to_s
ecr = ECR::Page.new.to_s # ECR is here just to have a base value to compare
raise "Different results" if blueprint_html != blueprint_raw_html && blueprint_html != ecr
Benchmark.ips do |x|
- x.report("Blueprint::HTML #{Blueprint::VERSION}") { BlueprintHTML::Page.new.to_html }
- x.report("Blueprint::RawHTML #{Blueprint::VERSION}") { BlueprintRawHTML::Page.new.to_html }
+ x.report("Blueprint::HTML #{Blueprint::VERSION}") { BlueprintHTML::Page.new.to_s }
+ x.report("Blueprint::RawHTML #{Blueprint::VERSION}") { BlueprintRawHTML::Page.new.to_s }
x.report("ECR") { ECR::Page.new.to_s }
end
diff --git a/spec/blueprint/html/attributes_handling_spec.cr b/spec/blueprint/html/attributes_handling_spec.cr
index 9d4af2b..74b22db 100644
--- a/spec/blueprint/html/attributes_handling_spec.cr
+++ b/spec/blueprint/html/attributes_handling_spec.cr
@@ -20,7 +20,7 @@ describe "attributes handling" do
Normal attributes
HTML
- page.to_html.should contain(div)
+ page.to_s.should contain(div)
end
it "converts attribute values to string" do
@@ -29,7 +29,7 @@ describe "attributes handling" do
Non-string attribute values
HTML
- page.to_html.should contain(span)
+ page.to_s.should contain(span)
end
it "replaces `_` by `-` on attribute names" do
@@ -38,7 +38,7 @@ describe "attributes handling" do
Transform attribute name
HTML
- page.to_html.should contain(section)
+ page.to_s.should contain(section)
end
it "accepts boolean attributes" do
@@ -47,7 +47,7 @@ describe "attributes handling" do
HTML
- page.to_html.should contain(input)
+ page.to_s.should contain(input)
end
it "expands nested attributes" do
@@ -56,7 +56,7 @@ describe "attributes handling" do
HTML
- page.to_html.should contain(nav)
+ page.to_s.should contain(nav)
end
it "flattens, compacts and joins array attributes" do
@@ -65,6 +65,6 @@ describe "attributes handling" do
Array attributes
HTML
- page.to_html.should contain(nav)
+ page.to_s.should contain(nav)
end
end
diff --git a/spec/blueprint/html/building_style_spec.cr b/spec/blueprint/html/building_style_spec.cr
index ed51a39..686f56c 100644
--- a/spec/blueprint/html/building_style_spec.cr
+++ b/spec/blueprint/html/building_style_spec.cr
@@ -102,7 +102,7 @@ describe "style building" do
end
it "allows to build style inside components" do
- actual_html = ButtonComponent.new.to_html { "Build Style!" }
+ actual_html = ButtonComponent.new.to_s { "Build Style!" }
expected_html = normalize_html <<-HTML
Build Style!
HTML
diff --git a/spec/blueprint/html/component_rendering_spec.cr b/spec/blueprint/html/component_rendering_spec.cr
index aad5798..beb1b1c 100644
--- a/spec/blueprint/html/component_rendering_spec.cr
+++ b/spec/blueprint/html/component_rendering_spec.cr
@@ -73,7 +73,7 @@ describe "component rendering" do
Basic component
HTML
- page.to_html.should contain(basic_component)
+ page.to_s.should contain(basic_component)
end
it "can provide content to another blueprints" do
@@ -86,7 +86,7 @@ describe "component rendering" do
HTML
- page.to_html.should contain(content_component)
+ page.to_s.should contain(content_component)
end
it "can use another blueprint methods" do
@@ -99,6 +99,6 @@ describe "component rendering" do
HTML
- page.to_html.should contain(complex_component)
+ page.to_s.should contain(complex_component)
end
end
diff --git a/spec/blueprint/html/components_registration_spec.cr b/spec/blueprint/html/components_registration_spec.cr
index 4db1c7f..4e13c04 100644
--- a/spec/blueprint/html/components_registration_spec.cr
+++ b/spec/blueprint/html/components_registration_spec.cr
@@ -60,7 +60,7 @@ describe "components registration" do
Component with required block
HTML
- page.to_html.should contain expected_html
+ page.to_s.should contain expected_html
end
it "allows component helper definition without required block" do
@@ -69,7 +69,7 @@ describe "components registration" do
Component without block
HTML
- page.to_html.should contain expected_html
+ page.to_s.should contain expected_html
end
it "allows component helper definition with optional block" do
@@ -79,6 +79,6 @@ describe "components registration" do
HTML
- page.to_html.should contain expected_html
+ page.to_s.should contain expected_html
end
end
diff --git a/spec/blueprint/html/conditional_rendering_spec.cr b/spec/blueprint/html/conditional_rendering_spec.cr
index dadb932..5e49b46 100644
--- a/spec/blueprint/html/conditional_rendering_spec.cr
+++ b/spec/blueprint/html/conditional_rendering_spec.cr
@@ -51,17 +51,17 @@ describe "conditional rendering" do
HTML
- page.to_html.should eq expected_html
+ page.to_s.should eq expected_html
end
end
context "when blueprint `#render?` returns false" do
it "doesn't render the blueprint" do
page = NoRenderPage.new
- page.to_html.should eq ""
+ page.to_s.should eq ""
page = NoRenderPage.new
- html = page.to_html { "This page will not be rendered" }
+ html = page.to_s { "This page will not be rendered" }
html.should eq ""
end
end
diff --git a/spec/blueprint/html/custom_elements_registration_spec.cr b/spec/blueprint/html/custom_elements_registration_spec.cr
index bcb94f2..8fde51c 100644
--- a/spec/blueprint/html/custom_elements_registration_spec.cr
+++ b/spec/blueprint/html/custom_elements_registration_spec.cr
@@ -23,7 +23,7 @@ describe "custom elements registration" do
Home
HTML
- page.to_html.should contain expected_html
+ page.to_s.should contain expected_html
end
it "allows passing content as first argument" do
@@ -32,7 +32,7 @@ describe "custom elements registration" do
Contact
HTML
- page.to_html.should contain expected_html
+ page.to_s.should contain expected_html
end
it "allows empty custom elements" do
@@ -41,7 +41,7 @@ describe "custom elements registration" do
HTML
- page.to_html.should contain expected_html
+ page.to_s.should contain expected_html
end
it "allows defining custom tags" do
@@ -50,6 +50,6 @@ describe "custom elements registration" do
HTML
- page.to_html.should contain expected_html
+ page.to_s.should contain expected_html
end
end
diff --git a/spec/blueprint/html/enveloping_spec.cr b/spec/blueprint/html/enveloping_spec.cr
index 3d305b0..8caf05b 100644
--- a/spec/blueprint/html/enveloping_spec.cr
+++ b/spec/blueprint/html/enveloping_spec.cr
@@ -56,6 +56,6 @@ describe "enveloping" do