Class: Glimmer::DSL::Libui::CustomControlSlotContentExpression

Inherits:
Expression
  • Object
show all
Defined in:
lib/glimmer/dsl/libui/custom_control_slot_content_expression.rb

Instance Method Summary collapse

Instance Method Details

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

Returns:

  • (Boolean)


30
31
32
33
34
35
# File 'lib/glimmer/dsl/libui/custom_control_slot_content_expression.rb', line 30

def can_interpret?(parent, keyword, *args, &block)
  slot = keyword.to_s.to_sym
  block_given? &&
    parent.is_a?(Glimmer::LibUI::CustomControl) &&
    parent.slot_controls.keys.include?(slot)
end

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



37
38
39
40
# File 'lib/glimmer/dsl/libui/custom_control_slot_content_expression.rb', line 37

def interpret(parent, keyword, *args, &block)
  slot = keyword.to_s.to_sym
  parent.slot_controls[slot]&.content(&block)
end