Class: SlimLint::CaptureMap

Inherits:
Hash
  • Object
show all
Defined in:
lib/slim_lint/capture_map.rb

Overview

Holds the list of captures, providing a convenient interface for accessing the values and unwrapping them on your behalf.

Instance Method Summary collapse

Instance Method Details

#[](capture_name) ⇒ Object

Returns the captured value with the specified name.

Parameters:

  • capture_name (Symbol)

Returns:

  • (Object)


11
12
13
14
15
16
17
# File 'lib/slim_lint/capture_map.rb', line 11

def [](capture_name)
  if key?(capture_name)
    super.value
  else
    raise ArgumentError, "Capture #{capture_name.inspect} does not exist!"
  end
end