Sha256: 715ed87508523baa37abb172c27b5de717b90a52097e94ad7aae67090c49fef8

Contents?: true

Size: 858 Bytes

Versions: 5

Compression:

Stored size: 858 Bytes

Contents

require 'glimmer/dsl/parent_expression'
require 'glimmer/web/element_proxy'

module Glimmer
  module DSL
    module Web
      module GeneralElementExpression
        include ParentExpression

        def interpret(parent, keyword, *args, &block)
          Glimmer::Web::ElementProxy.new(keyword, parent, args, block)
        end
        
        def add_content(parent, keyword, *args, &block)
          if parent.rendered? || parent.skip_content_on_render_blocks?
            return_value = super(parent, keyword, *args, &block)
            if return_value.is_a?(String) && parent.dom_element.text.to_s.empty?
              parent.add_text_content(return_value)
            end
            parent.post_add_content
            return_value
          else
            parent.add_content_on_render(&block)
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
glimmer-dsl-web-0.2.8 lib/glimmer/dsl/web/general_element_expression.rb
glimmer-dsl-web-0.2.7 lib/glimmer/dsl/web/general_element_expression.rb
glimmer-dsl-web-0.2.4 lib/glimmer/dsl/web/general_element_expression.rb
glimmer-dsl-web-0.2.3 lib/glimmer/dsl/web/general_element_expression.rb
glimmer-dsl-web-0.2.2 lib/glimmer/dsl/web/general_element_expression.rb