Class: Glimmer::DSL::Tk::BlockAttributeExpression

Inherits:
Expression
  • Object
show all
Defined in:
lib/glimmer/dsl/tk/block_attribute_expression.rb

Instance Method Summary collapse

Instance Method Details

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

Returns:

  • (Boolean)


28
29
30
31
32
# File 'lib/glimmer/dsl/tk/block_attribute_expression.rb', line 28

def can_interpret?(parent, keyword, *args, &block)
  block_given? and
    args.size == 0 and
    (parent.respond_to?("#{keyword}_block=") || (parent.respond_to?(:tk) && parent.tk.respond_to?(keyword)))
end

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



34
35
36
37
38
39
40
41
# File 'lib/glimmer/dsl/tk/block_attribute_expression.rb', line 34

def interpret(parent, keyword, *args, &block)
  if parent.respond_to?("#{keyword}_block=")
    parent.send("#{keyword}_block=", block)
  else
    parent.tk.send(keyword, block)
  end
  nil
end