Sha256: 2702296ddf736bae4c711444d699ba0588cf62eaf7ec654ddc9d525eaa1f73bd

Contents?: true

Size: 799 Bytes

Versions: 2

Compression:

Stored size: 799 Bytes

Contents

require 'glimmer/dsl/expression'
require 'glimmer/dsl/parent_expression'
require 'glimmer/swt/widget_proxy'

module Glimmer
  module DSL
    module Opal
      class WidgetExpression < Expression
        include ParentExpression
        EXCLUDED_KEYWORDS = %w[shell display]
  
        def can_interpret?(parent, keyword, *args, &block)
          !EXCLUDED_KEYWORDS.include?(keyword) and
            parent.is_a?(Glimmer::SWT::WidgetProxy) and
            Glimmer::SWT::WidgetProxy.widget_class(keyword)
        end

        def interpret(parent, keyword, *args, &block)
          Glimmer::SWT::WidgetProxy.for(keyword, parent, args, block)
        end

        def add_content(parent, &block)
          super(parent, &block)
          parent.post_add_content
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
glimmer-dsl-opal-0.7.0 lib/glimmer/dsl/opal/widget_expression.rb
glimmer-dsl-opal-0.6.1 lib/glimmer/dsl/opal/widget_expression.rb