Skip to content

Commit

Permalink
Ready for Phlex 2
Browse files Browse the repository at this point in the history
  • Loading branch information
benpickles committed Sep 5, 2024
1 parent 2e3c9a6 commit c66c146
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ You can now use Sinatra's `url()` helper method directly and its other methods (

```ruby
class MyView < Phlex::HTML
def template
def view_template
h1 { 'Phlex / Sinatra integration' }
p {
a(href: url('/foo', false)) { 'link to foo' }
Expand Down Expand Up @@ -58,7 +58,7 @@ You can also manually flush the contents of the buffer at any point using Phlex'

```ruby
class Layout < Phlex::HTML
def template(&block)
def view_template(&block)
doctype
html {
head {
Expand All @@ -77,7 +77,7 @@ class Layout < Phlex::HTML
end

class MyView < Phlex::HTML
def template
def view_template
render Layout.new {
# Knowing that this page can take a while to generate we can choose to
# flush here so the browser can render the site header while downloading
Expand Down
10 changes: 5 additions & 5 deletions spec/phlex/sinatra_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ def initialize(text = 'foo')
@text = text
end

def template
def view_template
p { @text }
end
end
Expand All @@ -15,19 +15,19 @@ def initialize(full)
@full = full
end

def template
def view_template
a(href: url('/bar', @full)) { 'link' }
end
end

class MoreDetailsView < Phlex::HTML
def template
def view_template
pre { helpers.params.inspect }
end
end

class StreamingView < Phlex::HTML
def template
def view_template
html {
head {
title { 'Streaming' }
Expand All @@ -42,7 +42,7 @@ def template
end

class SvgElem < Phlex::SVG
def template
def view_template
svg { rect(width: 100, height: 100) }
end
end
Expand Down

0 comments on commit c66c146

Please sign in to comment.