Class: RMXFirebaseViewController

Inherits:
RMXViewController
  • Object
show all
Extended by:
RMXFirebaseHandleModel
Defined in:
lib/motion/RMXFirebaseViewController.rb

Instance Method Summary collapse

Methods included from RMXFirebaseHandleModel

handle

Instance Method Details

#changedObject



16
17
# File 'lib/motion/RMXFirebaseViewController.rb', line 16

def changed
end

#modelObject



19
20
21
# File 'lib/motion/RMXFirebaseViewController.rb', line 19

def model
  @model
end

#model=(val) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/motion/RMXFirebaseViewController.rb', line 23

def model=(val)
  return @model if @model == val
  if @model
    @model_unbinder.call if @model_unbinder
    @model_unbinder = nil
  end
  @model = val
  if @model
    unless @model.ready?
      raise "#{className} tried to use a model that is not ready: #{@model.inspect}"
    end
    @model_unbinder = @model.always do |m|
      next unless m == @model
      if isViewLoaded
        changed
      else
        @pending_changed = true
      end
    end
  end
  @model
end

#viewDidLoadObject



5
6
7
8
9
10
11
12
13
14
# File 'lib/motion/RMXFirebaseViewController.rb', line 5

def viewDidLoad
  s = super
  if @pending_changed
    @pending_changed = nil
    if @model
      changed
    end
  end
  s
end