Skip to content

Conversation

@ksilex
Copy link
Owner

@ksilex ksilex commented Feb 25, 2021

No description provided.

end

def error
[404, {'Content-Type' => 'text/plain'}, ['404: Page not found']]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rack::Response?

Simpler.root.join(VIEW_BASE_PATH, "#{path}.html.erb")
end

def plain(content)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Можно сделать отдельный класс для рендеринга каждого типа ответа: HTMLRenderer, PlainTextRenderrer. Каждый из таких классов может определять свой метод render. Тогда в обязанность View будет входить выбор нужного класса на основе информации из env и делегирование ему вызова метода render.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants