Skip to content

Commit

Permalink
Add content type and file name to Phlex::HTML and Phlex::SVG
Browse files Browse the repository at this point in the history
  • Loading branch information
joeldrapper committed Feb 18, 2024
1 parent 3e9c4f7 commit 558087b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/phlex/csv.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,14 @@ def call(buffer = +"", view_context: nil)
buffer
end

def filename
def file_name
nil
end

def content_type
"text/csv"
end

private

def column(header = nil, value)
Expand Down
8 changes: 8 additions & 0 deletions lib/phlex/html.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ def unbuffered
self.class.__unbuffered_class__.new(self)
end

def file_name
nil
end

def content_type
"text/html"
end

# This should be extended after all method definitions
extend ElementClobberingGuard
end
Expand Down
8 changes: 8 additions & 0 deletions lib/phlex/svg.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,13 @@ class SVG < SGML

# This should be extended after all method definitions
extend ElementClobberingGuard

def content_type
"image/svg+xml"
end

def file_name
nil
end
end
end

0 comments on commit 558087b

Please sign in to comment.