class Serum::Rails::TypeSelection

Constants

DEFAULT_TYPES
EXTENSIONS_BY_TYPE

Public Class Methods

new(types = nil) click to toggle source
# File lib/serum/rails/type_selection.rb, line 13
def initialize(types = nil)
  @types = types ? Array.wrap(types) : DEFAULT_TYPES
end

Public Instance Methods

extensions() click to toggle source

def matches_path?(path)

extensions.any? { |extension|
  path.ends_with?("\.#{extension}")
}

end

# File lib/serum/rails/type_selection.rb, line 23
def extensions
  @types.collect { |type|
    EXTENSIONS_BY_TYPE[type] or raise "No such type: #{type}"
  }.flatten
end