Class: CabezaDeTermo::Assets::HanamiRenderingScope

Inherits:
Object
  • Object
show all
Defined in:
lib/cabeza-de-termo/assets/rendering-scope-adaptors/hanami-rendering-scope.rb

Overview

This class is a wrapper on a Hanami::Views::LayoutScope object to delegate the :collect_stylesheets_with and :collect_javascripts_with to the actual layout_scope.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(layout_scope) ⇒ HanamiRenderingScope

Instance methods



35
36
37
# File 'lib/cabeza-de-termo/assets/rendering-scope-adaptors/hanami-rendering-scope.rb', line 35

def initialize(layout_scope)
	@layout_scope = layout_scope
end

Class Method Details

.each_javascript_from(layout_scope, &block) ⇒ Object

Collect the javascripts from the layout_scope and iterate over each javascript



29
30
31
# File 'lib/cabeza-de-termo/assets/rendering-scope-adaptors/hanami-rendering-scope.rb', line 29

def self.each_javascript_from(layout_scope, &block)
	javascripts_from(layout_scope).each(&block)
end

.each_stylesheet_from(layout_scope, &block) ⇒ Object

Collect the stylesheets from the layout_scope and iterate over each stylesheet



24
25
26
# File 'lib/cabeza-de-termo/assets/rendering-scope-adaptors/hanami-rendering-scope.rb', line 24

def self.each_stylesheet_from(layout_scope, &block)
	stylesheets_from(layout_scope).each(&block)
end

.javascripts_from(layout_scope) ⇒ Object

Collect the javascripts from the layout_scope



19
20
21
# File 'lib/cabeza-de-termo/assets/rendering-scope-adaptors/hanami-rendering-scope.rb', line 19

def self.javascripts_from(layout_scope)
	Library.javascripts_for (self.on layout_scope)
end

.on(layout_scope) ⇒ Object

Answer a new adaptor on the layout_scope



9
10
11
# File 'lib/cabeza-de-termo/assets/rendering-scope-adaptors/hanami-rendering-scope.rb', line 9

def self.on(layout_scope)
	new(layout_scope)
end

.stylesheets_from(layout_scope) ⇒ Object

Collect the stylesheets from the layout_scope



14
15
16
# File 'lib/cabeza-de-termo/assets/rendering-scope-adaptors/hanami-rendering-scope.rb', line 14

def self.stylesheets_from(layout_scope)
	Library.stylesheets_for (self.on layout_scope)
end

Instance Method Details

#collect_javascripts_with(assets_collector) ⇒ Object

Delegate the :collect_javascripts_with method to the actual Hanami::LayoutScope



46
47
48
49
# File 'lib/cabeza-de-termo/assets/rendering-scope-adaptors/hanami-rendering-scope.rb', line 46

def collect_javascripts_with(assets_collector)
	collect_javascripts_from_layout_with assets_collector
	collect_javascripts_from_view_with assets_collector
end

#collect_stylesheets_with(assets_collector) ⇒ Object

Delegate the :collect_stylesheets_with method to the actual Hanami::LayoutScope



40
41
42
43
# File 'lib/cabeza-de-termo/assets/rendering-scope-adaptors/hanami-rendering-scope.rb', line 40

def collect_stylesheets_with(assets_collector)
	collect_stylesheets_from_layout_with assets_collector
	collect_stylesheets_from_view_with assets_collector
end