Module: Glimmer::DSL::ObserveExpression
- Defined in:
- lib/glimmer/dsl/observe_expression.rb
Constant Summary collapse
- REGEX_NESTED_OR_INDEXED_PROPERTY =
/([^\[]+)(\[[^\]]+\])?/
Instance Method Summary collapse
- #can_interpret?(parent, keyword, *args, &block) ⇒ Boolean
- #interpret(parent, keyword, *args, &block) ⇒ Object
Instance Method Details
#can_interpret?(parent, keyword, *args, &block) ⇒ Boolean
30 31 32 33 34 35 |
# File 'lib/glimmer/dsl/observe_expression.rb', line 30 def can_interpret?(parent, keyword, *args, &block) keyword == 'observe' and block_given? and (args.size >= 1) and (args[1].nil? || args[1].is_a?(Hash) || textual?(args[1])) end |
#interpret(parent, keyword, *args, &block) ⇒ Object
37 38 39 40 41 |
# File 'lib/glimmer/dsl/observe_expression.rb', line 37 def interpret(parent, keyword, *args, &block) observer = DataBinding::Observer.proc(&block) observer_registration = observer.observe(DataBinding::ModelBinding.new(*args)) observer_registration end |