Module: Mayu::Resources::Types

Extended by:
T::Sig
Defined in:
lib/mayu/resources/types.rb,
lib/mayu/resources/types/nil.rb,
lib/mayu/resources/types/svg.rb,
lib/mayu/resources/types/base.rb,
lib/mayu/resources/types/image.rb,
lib/mayu/resources/types/component.rb,
lib/mayu/resources/types/javascript.rb,
lib/mayu/resources/types/stylesheet.rb

Defined Under Namespace

Classes: Base, Component, Image, JavaScript, Nil, SVG, Stylesheet

Class Method Summary collapse

Class Method Details

.for_path(path) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/mayu/resources/types.rb', line 17

def self.for_path(path)
  case path
  when /\.rb\z/
    return Component
  when /\.haml\z/
    return Component
  when /\.js\z/
    return JavaScript
  when /\.css\z/
    return Stylesheet
  when /\.(png|jpe?g|gif|webp)$\z/
    return Image
  when /\.svg\z/
    return SVG
  end

  raise "No type for #{path}"
end