Module: Hamlit::ObjectRef

Defined in:
lib/hamlit/object_ref.rb,
ext/hamlit/hamlit.c

Class Method Summary collapse

Class Method Details

.parse(args) ⇒ Object



5
6
7
8
9
10
11
12
13
14
# File 'lib/hamlit/object_ref.rb', line 5

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

  suffix = underscore(object.class)
  {
    'class' => [prefix, suffix].compact.join('_'),
    'id'    => [prefix, suffix, object.id || 'new'].compact.join('_'),
  }
end