class Haml::Buffer
def parse_object_ref(ref)
The second object, if present, is used as a prefix,
one to create an attributes hash.
Takes an array of objects and uses the class and id of the first
def parse_object_ref(ref) prefix = ref[1] ref = ref[0] # Let's make sure the value isn't nil. If it is, return the default Hash. return {} if ref.nil? class_name = underscore(ref.class) id = "#{class_name}_#{ref.id || 'new'}" if prefix class_name = "#{ prefix }_#{ class_name}" id = "#{ prefix }_#{ id }" end {'id' => id, 'class' => class_name} end