Class: Glimmer::DSL::Opal::ImageExpression

Inherits:
Expression
  • Object
show all
Includes:
ParentExpression, TopLevelExpression
Defined in:
lib/glimmer/dsl/opal/image_expression.rb

Overview

image expression Note: Cannot be a static expression because it clashes with image property expression

Instance Method Summary collapse

Instance Method Details

#add_content(parent, keyword, *args, &block) ⇒ Object



56
57
58
59
60
# File 'lib/glimmer/dsl/opal/image_expression.rb', line 56

def add_content(parent, keyword, *args, &block)
  return if @create_pixel_by_pixel || block&.parameters&.count == 2
  super(parent, keyword, *args, &block)
  parent.post_add_content
end

#can_interpret?(parent, keyword, *args, &block) ⇒ Boolean

Returns:

  • (Boolean)


36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/glimmer/dsl/opal/image_expression.rb', line 36

def can_interpret?(parent, keyword, *args, &block)
  options = args.last.is_a?(Hash) ? args.last : {}
  (
    (keyword == 'image') and
    (
      options.keys.include?(:top_level) or
      (
        !parent.is_a?(Glimmer::SWT::Custom::Shape) &&
        !parent.is_a?(Glimmer::SWT::CanvasProxy)
      )
    )
  )
end

#interpret(parent, keyword, *args, &block) ⇒ Object



50
51
52
53
54
# File 'lib/glimmer/dsl/opal/image_expression.rb', line 50

def interpret(parent, keyword, *args, &block)
#           options = args.last.is_a?(Hash) ? args.last : {}
#           args.unshift(parent) unless parent.nil? || options[:top_level]
  Glimmer::SWT::ImageProxy.create(*args, &block)
end