Class: Amrita2::Renderers::ElseRenderer

Inherits:
Base show all
Defined in:
lib/amrita2/template.rb

Instance Method Summary collapse

Constructor Details

#initializeElseRenderer

Returns a new instance of ElseRenderer.



1926
1927
1928
# File 'lib/amrita2/template.rb', line 1926

def initialize
  super("Object")
end

Instance Method Details

#generate_body(cg, de, element) ⇒ Object



1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
# File 'lib/amrita2/template.rb', line 1944

def generate_body(cg, de, element)
  if de.has_ruby?
    de.element_render_code(cg, element) do
      de.children.each do |c|
        c.render_me(cg)
      end
    end
  else
    cg.put_expression('raise %[type mismatch, got (#{$_.inspect}) for ' + element.to_s.inspect + ' ]')
  end
end

#generate_body_new(cg, de, element) ⇒ Object



1936
1937
1938
1939
1940
1941
1942
# File 'lib/amrita2/template.rb', line 1936

def generate_body_new(cg, de, element)
  de.element_render_code(cg, element) do
    de.children.each do |c|
      c.render_me(cg)
    end
  end
end

#generate_when(cg) ⇒ Object



1930
1931
1932
1933
1934
# File 'lib/amrita2/template.rb', line 1930

def generate_when(cg)
  cg.else_ do
    yield
  end
end