public
Rubygem
Description: HTML Abstraction Markup Language - A Markup Haiku
Homepage: http://haml.hamptoncatlin.com
Clone URL: git://github.com/nex3/haml.git
Search Repo:
nex3 (author)
Tue Apr 29 19:13:30 -0700 2008
commit  2c32f081cf5392ba0de96634488e555131d017a0
tree    b8a4f591bcefedac20f651fe02620163b95db4c9
parent  64ba951437abecf3666dc7a24a6ca656113e01d0
haml / lib / haml / util.rb
100644 30 lines (28 sloc) 0.765 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# This file contains various useful bits of code
# that are shared between Haml and Sass.
 
class Hash # :nodoc:
  # Same as Hash#merge!,
  # but recursively merges sub-hashes
  def rec_merge!(other)
    other.each do |key, value|
      myval = self[key]
      if value.is_a?(Hash) && myval.is_a?(Hash)
        myval.rec_merge!(value)
      else
        self[key] = value
      end
    end
    self
  end
end
 
class Object
  # Haml overrides various ActionView helpers,
  # which call an #is_haml? method
  # to determine whether or not the current context object
  # is a proper Haml context.
  # Because ActionView helpers may be included in non-ActionView::Base classes,
  # it's a good idea to define is_haml? for all objects.
  def is_haml?
    false
  end
end