Class: CabezaDeTermo::AssetsPublisher::Publisher

Inherits:
Object
  • Object
show all
Defined in:
lib/cabeza-de-termo/assets-publisher/publisher.rb,
lib/cabeza-de-termo/assets-publisher/version.rb

Overview

The collector and publisher of the stylesheets and javascripts from the current view.

Constant Summary collapse

VERSION =
"2.0.0"

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.clock_card_machineObject



35
36
37
# File 'lib/cabeza-de-termo/assets-publisher/publisher.rb', line 35

def clock_card_machine()
  @clock_card_machine
end

.configurationObject

Answer the Publihser configuration



26
27
28
# File 'lib/cabeza-de-termo/assets-publisher/publisher.rb', line 26

def configuration()
  configurations_per_thread[::Thread.current]
end

.configuration_prototypeObject

Answer the Publihser configuration



44
45
46
# File 'lib/cabeza-de-termo/assets-publisher/publisher.rb', line 44

def configuration_prototype()
  @configuration_prototype ||= default_configuration
end

.configurations_per_threadObject



39
40
41
# File 'lib/cabeza-de-termo/assets-publisher/publisher.rb', line 39

def configurations_per_thread()
  @configurations_per_thread
end

.configure(&block) ⇒ Object

Pass the config to the block to allow the app to configure the Publisher



31
32
33
# File 'lib/cabeza-de-termo/assets-publisher/publisher.rb', line 31

def configure(&block)
  CdT.bind_block_evaluation_to configuration_prototype, &block
end

.default_configurationObject



52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/cabeza-de-termo/assets-publisher/publisher.rb', line 52

def default_configuration()
  CdT.bind_block_evaluation_to(Configuration.new) do
    add_timestamps_to_published_assets true

    stylesheets_compiler { TiltCompiler.new }
    javascripts_compiler { TiltCompiler.new }

    use_rendering_scope_assets_collector CabezaDeTermo::Assets::HanamiRenderingScope

    self
  end
end

.reset_configuration_prototypeObject



48
49
50
# File 'lib/cabeza-de-termo/assets-publisher/publisher.rb', line 48

def reset_configuration_prototype()
  @configuration_prototype = nil
end

Instance Method Details

#javascripts_for(rendering_scope) ⇒ Object

Collect and publish the javascripts from the rendering_scope. Answer the html to include in your template.



78
79
80
81
82
# File 'lib/cabeza-de-termo/assets-publisher/publisher.rb', line 78

def javascripts_for(rendering_scope)
  with_configuration_copy do
    compile_and_build_html_for(JavascriptType.new, rendering_scope)
  end
end

#stylesheets_for(rendering_scope) ⇒ Object

Collect and publish the stylesheets from the rendering_scope. Answer the html to include in your template.



70
71
72
73
74
# File 'lib/cabeza-de-termo/assets-publisher/publisher.rb', line 70

def stylesheets_for(rendering_scope)
  with_configuration_copy do
    compile_and_build_html_for(StylesheetType.new, rendering_scope)
  end
end