Class: Locomotive::Steam::Middlewares::WysihtmlCss
- Inherits:
-
Object
- Object
- Locomotive::Steam::Middlewares::WysihtmlCss
- Defined in:
- lib/locomotive/steam/middlewares/wysihtml_css.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, opts = {}) ⇒ WysihtmlCss
constructor
A new instance of WysihtmlCss.
Constructor Details
#initialize(app, opts = {}) ⇒ WysihtmlCss
Returns a new instance of WysihtmlCss.
7 8 9 |
# File 'lib/locomotive/steam/middlewares/wysihtml_css.rb', line 7 def initialize(app, opts = {}) @app = app end |
Instance Method Details
#call(env) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/locomotive/steam/middlewares/wysihtml_css.rb', line 11 def call(env) status, headers, response = @app.call(env) if content?(env['steam.page'], response) url = ::ActionController::Base.helpers.stylesheet_url('locomotive/wysihtml5_editor') html = %(<link rel="stylesheet" type="text/css" href="#{url}">) response.first.gsub!('</head>', %(#{html}</head>)) end [status, headers, response] end |