Class: Pannier::Tags::JavaScript

Inherits:
Object
  • Object
show all
Includes:
Helpers
Defined in:
lib/pannier/mounted/tags.rb

Instance Method Summary collapse

Methods included from Helpers

#attrs_to_s, #escape

Instance Method Details

#call(path, attrs) ⇒ Object



38
39
40
41
42
43
44
45
# File 'lib/pannier/mounted/tags.rb', line 38

def call(path, attrs)
  attrs = attrs_to_s({
    :type => 'text/javascript',
    :src  => path
  }.merge(attrs))
  
  template.result(binding)
end

#templateObject



47
48
49
50
51
# File 'lib/pannier/mounted/tags.rb', line 47

def template
  ERB.new(<<-erb.strip)
    <script <%= attrs %>></script>
  erb
end