Class: CssViews::Handler
- Inherits:
-
Object
- Object
- CssViews::Handler
- Defined in:
- lib/css_views/handler.rb
Instance Method Summary collapse
- #body ⇒ Object
- #etag ⇒ Object
-
#initialize(configuration, controller) ⇒ Handler
constructor
A new instance of Handler.
- #last_modified ⇒ Object
- #render ⇒ Object
- #transform(css) ⇒ Object
Constructor Details
#initialize(configuration, controller) ⇒ Handler
Returns a new instance of Handler.
3 4 5 6 |
# File 'lib/css_views/handler.rb', line 3 def initialize(configuration, controller) @configuration = configuration @controller = controller end |
Instance Method Details
#body ⇒ Object
12 13 14 15 16 |
# File 'lib/css_views/handler.rb', line 12 def body @configuration.components.map do |view| @controller.send(:render_to_string, view) end.join("\n") end |
#etag ⇒ Object
22 23 24 |
# File 'lib/css_views/handler.rb', line 22 def etag template_files.map {|f| File.mtime(f) } end |
#last_modified ⇒ Object
18 19 20 |
# File 'lib/css_views/handler.rb', line 18 def last_modified template_files.map {|f| File.mtime(f) }.max end |
#render ⇒ Object
8 9 10 |
# File 'lib/css_views/handler.rb', line 8 def render transform(body) end |
#transform(css) ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/css_views/handler.rb', line 26 def transform(css) if transformers = @configuration.transformers transformers.each do |transformer| css = transformer.transform(css) end end css end |