Sha256: 47c13a79aac591b42671d3836b8e730de0325eb52d03050c380522d3eb001778

Contents?: true

Size: 485 Bytes

Versions: 20

Compression:

Stored size: 485 Bytes

Contents

module SlimLint
  # Holds the list of captures, providing a convenient interface for accessing
  # the values and unwrapping them on your behalf.
  class CaptureMap < Hash
    # Returns the captured value with the specified name.
    #
    # @param capture_name [Symbol]
    # @return [Object]
    def [](capture_name)
      if key?(capture_name)
        super.value
      else
        raise ArgumentError, "Capture #{capture_name.inspect} does not exist!"
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
slim_lint-0.15.1 lib/slim_lint/capture_map.rb
slim_lint-0.15.0 lib/slim_lint/capture_map.rb
slim_lint-0.14.0 lib/slim_lint/capture_map.rb
slim_lint-0.13.0 lib/slim_lint/capture_map.rb
slim_lint-0.12.0 lib/slim_lint/capture_map.rb
slim_lint-0.11.0 lib/slim_lint/capture_map.rb
slim_lint-0.10.0 lib/slim_lint/capture_map.rb
slim_lint-0.9.0 lib/slim_lint/capture_map.rb
slim_lint-0.8.3 lib/slim_lint/capture_map.rb
slim_lint-0.8.2 lib/slim_lint/capture_map.rb
slim_lint-0.8.1 lib/slim_lint/capture_map.rb
slim_lint-0.8.0 lib/slim_lint/capture_map.rb
slim_lint-0.7.2 lib/slim_lint/capture_map.rb
slim_lint-0.7.1 lib/slim_lint/capture_map.rb
slim_lint-0.7.0 lib/slim_lint/capture_map.rb
slim_lint-0.6.1 lib/slim_lint/capture_map.rb
slim_lint-0.6.0 lib/slim_lint/capture_map.rb
slim_lint-0.5.0 lib/slim_lint/capture_map.rb
slim_lint-0.4.0 lib/slim_lint/capture_map.rb
slim_lint-0.3.0 lib/slim_lint/capture_map.rb