Class: Hpricot::Elem

Inherits:
Object
  • Object
show all
Defined in:
lib/eex2slime/hpricot_monkeypatches.rb

Constant Summary collapse

BLANK_RE =
/\A[[:space:]]*\z/

Instance Method Summary collapse

Instance Method Details

#slime(lvl = 0) ⇒ Object



67
68
69
70
71
72
73
74
75
76
77
# File 'lib/eex2slime/hpricot_monkeypatches.rb', line 67

def slime(lvl=0)
  r = '  ' * lvl

  return r + slime_elixir_code(r) if elixir?

  r += name unless skip_tag_name?
  r += slime_id
  r += slime_class
  r += slime_attributes
  r
end

#to_slime(lvl = 0) ⇒ Object



79
80
81
82
83
84
85
# File 'lib/eex2slime/hpricot_monkeypatches.rb', line 79

def to_slime(lvl=0)
  if respond_to?(:children) and children
    [slime(lvl), children_slime(lvl)].join("\n")
  else
    slime(lvl)
  end
end