Class: HamlLint::Adapter

Inherits:
Object
  • Object
show all
Defined in:
lib/haml_lint/adapter.rb,
lib/haml_lint/adapter/haml_4.rb,
lib/haml_lint/adapter/haml_5.rb

Overview

Determines the adapter to use for the current Haml version

Direct Known Subclasses

Haml4, Haml5

Defined Under Namespace

Classes: Haml4, Haml5

Class Method Summary collapse

Class Method Details

.detect_classClass

Detects the adapter to use for the current Haml version

Examples:

HamlLint::Adapter.detect_class.new('%div')

Returns:

  • (Class)

    the adapter class

Raises:


18
19
20
21
22
23
24
25
# File 'lib/haml_lint/adapter.rb', line 18

def self.detect_class
  version = haml_version
  case version
  when '~> 4.0' then HamlLint::Adapter::Haml4
  when '~> 5.0', '~> 5.1' then HamlLint::Adapter::Haml5
  else fail HamlLint::Exceptions::UnknownHamlVersion, "Cannot handle Haml version: #{version}"
  end
end