Sha256: fa4f47055d30e8b513f9ef8e0418a5be0d9fb0190ecaa2d7a7d1a8a43af1fdac

Contents?: true

Size: 858 Bytes

Versions: 10

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.for(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

10 entries across 10 versions & 1 rubygems

Version Path
glimmer-dsl-web-0.2.0 lib/glimmer/dsl/web/general_element_expression.rb
glimmer-dsl-web-0.1.1 lib/glimmer/dsl/web/general_element_expression.rb
glimmer-dsl-web-0.1.0 lib/glimmer/dsl/web/general_element_expression.rb
glimmer-dsl-web-0.0.12 lib/glimmer/dsl/web/general_element_expression.rb
glimmer-dsl-web-0.0.11 lib/glimmer/dsl/web/general_element_expression.rb
glimmer-dsl-web-0.0.10 lib/glimmer/dsl/web/general_element_expression.rb
glimmer-dsl-web-0.0.9 lib/glimmer/dsl/web/general_element_expression.rb
glimmer-dsl-web-0.0.8 lib/glimmer/dsl/web/general_element_expression.rb
glimmer-dsl-web-0.0.7 lib/glimmer/dsl/web/general_element_expression.rb
glimmer-dsl-web-0.0.6 lib/glimmer/dsl/web/general_element_expression.rb