Sha256: 6ebfa2db7c18d5a34513e4cd6deabfcfe5143254607d8de91664fc21932a66be

Contents?: true

Size: 753 Bytes

Versions: 1

Compression:

Stored size: 753 Bytes

Contents

require 'glimmer/dsl/expression'
require 'glimmer/swt/custom/shape'

module Glimmer
  module DSL
    module Opal
      class PropertyExpression < StaticExpression
        def can_interpret?(parent, keyword, *args, &block)
          parent and
            (!args.empty?) and
            parent.respond_to?(:set_attribute) and
            parent.respond_to?(keyword, *args) and
            keyword and
            block.nil?
        end

        def interpret(parent, keyword, *args, &block)
          if keyword == 'text' # TODO move into property converters in element proxy
            args = [args.first.to_s.gsub('&', '')]
          end
          parent.set_attribute(keyword, *args)
          args.first.to_s
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
glimmer-dsl-opal-0.28.3 lib/glimmer/dsl/opal/property_expression.rb