module Glimmer::DSL::BindExpression

Responsible for setting up the return value of the bind keyword (command symbol) as a ModelBinding. It is to be used as the argument of another data-binding expression.

Public Instance Methods

can_interpret?(parent, keyword, *args, &block) click to toggle source
# File lib/glimmer/dsl/bind_expression.rb, line 30
def can_interpret?(parent, keyword, *args, &block)
  (
    keyword == 'bind' and
      (
        (
          (args.size == 1)
        ) ||
        (
          (args.size == 2) and
            textual?(args[1])
        ) ||
        (
          (args.size == 2) and
            (args[1].is_a?(Hash))
        ) ||
          (
            (args.size == 3) and
              textual?(args[1]) and
              (args[2].is_a?(Hash))
          )
      )
  )
end
interpret(parent, keyword, *args, &block) click to toggle source
# File lib/glimmer/dsl/bind_expression.rb, line 55
def interpret(parent, keyword, *args, &block)
  binding_options = args.last.is_a?(Hash) ? args.pop : {}
  binding_options[:on_read] = binding_options.delete(:on_read) || binding_options.delete('on_read') || block
  DataBinding::ModelBinding.new(*args, binding_options)
end