Class: UIView

Inherits:
Object
  • Object
show all
Defined in:
lib/nitron/ui/extensions/ui_view.rb

Instance Method Summary collapse

Instance Method Details

#dataBindingsObject



2
3
4
# File 'lib/nitron/ui/extensions/ui_view.rb', line 2

def dataBindings
  @_dataBindings ||= {}
end

#outletsObject



6
7
8
# File 'lib/nitron/ui/extensions/ui_view.rb', line 6

def outlets
  @_outlets ||= {}
end

#setValue(value, forUndefinedKey: key) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/nitron/ui/extensions/ui_view.rb', line 10

def setValue(value, forUndefinedKey:key)
  if key == "dataBinding" || key == "outlet"
    raise "Runtime attribute '#{key}' must be a String (declared on #{self.class.name})" unless value.is_a?(String)

    container = self
    while container.superview
      container = container.superview
    end

    if key == "dataBinding"
      unless value.start_with?("model.")
       raise "Data binding expression must start with 'model.'; you provided '#{value}'"
      end

      container.dataBindings[value[6..-1]] = self
    else
      container.outlets[value] = self
    end
  else
    super
  end
end