Class: Glimmer::DSL::Libui::DataBindingExpression

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

Overview

Responsible for wiring data-binding Depends on BindExpression

Instance Method Summary collapse

Instance Method Details

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

Returns:

  • (Boolean)


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

def can_interpret?(parent, keyword, *args, &block)
  args.size == 1 and
    args[0].is_a?(DataBinding::ModelBinding) and
    parent.respond_to?(:data_bind)
end

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



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

def interpret(parent, keyword, *args, &block)
  property = keyword
  model_binding = args[0]
  parent.data_bind(property, model_binding)
end