Class: ERBLint::Linters::StartTagHelper::Attribute

Inherits:
Object
  • Object
show all
Defined in:
lib/erb_lint/linters/deprecated_classes.rb

Overview

Represents and provides an interface for an attribute found in a start tag in the HTML.

Constant Summary collapse

ATTR_NAME_CLASS_PATTERN =

attribute names are case-insensitive

/\Aclass\z/i

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attribute_name, value) ⇒ Attribute

Returns a new instance of Attribute.



120
121
122
123
# File 'lib/erb_lint/linters/deprecated_classes.rb', line 120

def initialize(attribute_name, value)
  @attribute_name = attribute_name
  @value = value
end

Instance Attribute Details

#attribute_nameObject

Returns the value of attribute attribute_name.



118
119
120
# File 'lib/erb_lint/linters/deprecated_classes.rb', line 118

def attribute_name
  @attribute_name
end

#valueObject

Returns the value of attribute value.



118
119
120
# File 'lib/erb_lint/linters/deprecated_classes.rb', line 118

def value
  @value
end

Instance Method Details

#class?Boolean

Returns:

  • (Boolean)


125
126
127
# File 'lib/erb_lint/linters/deprecated_classes.rb', line 125

def class?
  ATTR_NAME_CLASS_PATTERN.match(@attribute_name)
end