Class: Haml::Buffer

Inherits:
Object
  • Object
show all
Defined in:
lib/to_erb/erb_engine.rb

Instance Method Summary collapse

Instance Method Details

#extended_attributes(class_id, obj_ref, *attributes_hashes) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/to_erb/erb_engine.rb', line 8

def extended_attributes(class_id, obj_ref, *attributes_hashes)

  attributes = class_id
  attributes_hashes.each do |old|
	hash = to_hash(old.map {|k, v| [k.to_s, v]})
	attributes.merge!(hash)
  end

  self.class.merge_attrs(attributes, parse_object_ref(obj_ref)) if obj_ref

  str_attrs = []
  attributes.each do |k,v|
    value = if Sexp === v
      "'<%= #{Ruby2Ruby.new.process v} %>'"
    else
      v.gsub("'","\\'")
    end

    str_attrs << "#{k}=#{value}"
  end   

  " "+str_attrs.join(" ")
end