Class: Jekyll::Assets::Default::Audio

Inherits:
Jekyll::Assets::Default show all
Defined in:
lib/jekyll/assets/plugins/html/defaults/audio.rb

Instance Attribute Summary

Attributes inherited from Extensible

#args, #asset, #ctx, #env, #jekyll

Instance Method Summary collapse

Methods inherited from Jekyll::Assets::Default

#config, get, #run, set, set_static, static

Methods inherited from Extensible

for?, for_args?, for_type?, inherited, #initialize, internal!, internal?, requirements

Constructor Details

This class inherits a constructor from Jekyll::Assets::Extensible

Instance Method Details

#integrity?Boolean

Returns:

  • (Boolean)


44
45
46
47
# File 'lib/jekyll/assets/plugins/html/defaults/audio.rb', line 44

def integrity?
  config[:integrity] && !asset.is_a?(Url) &&
    !args.key?(:integrity)
end

#set_controlsObject



24
25
26
27
28
29
30
31
# File 'lib/jekyll/assets/plugins/html/defaults/audio.rb', line 24

def set_controls
  return if args.key?(:controls)

  args[:controls] = true
  unless args.key?(:controlsList) || args.key?(:controlslist)
    args[:controlList] = "nodownload"
  end
end

#set_integrityObject



34
35
36
37
38
39
40
41
# File 'lib/jekyll/assets/plugins/html/defaults/audio.rb', line 34

def set_integrity
  return unless integrity?

  args[:integrity] = asset.integrity
  unless args.key?(:crossorigin)
    args[:crossorigin] = "anonymous"
  end
end

#set_srcObject



15
16
17
18
19
20
21
# File 'lib/jekyll/assets/plugins/html/defaults/audio.rb', line 15

def set_src
  dpath = asset.digest_path
  return args[:src] = asset.url if asset.is_a?(Url)
  return args[:src] = env.prefix_url(dpath) unless args[:inline]
  # This is insanity, but who am I to judge you, and what you do.
  args[:src] = asset.data_uri
end