Module: HamlLayouts::Models::Page

Defined in:
lib/haml_layouts/models/page.rb

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/haml_layouts/models/page.rb', line 5

def self.included(base)
  base.class_eval do
    
    def parse_object(object)
      # We don't want to return the haml on a layout by default
      text =  object.is_a?(Layout) ? object.rendered_content : object.content
                  
      if object.respond_to? :filter_id
        if object.filter_id == 'Haml'
          # We want to render the tags as html/radius before passing them
          text = object.filter.filter(text)
          text = parse(text)
        else
          text = parse(text)
          text = object.filter.filter(text)
        end
      else
        text = parse(text)
      end
      text
    end
    
  end
end