# Module: Haml::ObjectRef

Defined in:
  lib/haml/object_ref.rb

## Class Method Summary collapse

- .parse(args)

## Class Method Details

### .parse(args)

    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19

    # File 'lib/haml/object_ref.rb', line 5

    def parse(args)
      object, prefix = args
      return {} unless object

      suffix =
        if object.respond_to?(:haml_object_ref)
          object.haml_object_ref
        else
          underscore(object.class)
        end
      {
        'class' => [prefix, suffix].compact.join('_'),
        'id'    => [prefix, suffix, object.id || 'new'].compact.join('_'),
      }
    end