Class: Turbo::Visit

Inherits:
Object
  • Object
show all
Defined in:
lib/turbo/visit/visit.rb

Direct Known Subclasses

ColdBootVisit, JavaScriptVisit

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#bridgeObject (readonly)

Returns the value of attribute bridge.



4
5
6
# File 'lib/turbo/visit/visit.rb', line 4

def bridge
  @bridge
end

#delegateObject

Returns the value of attribute delegate.



3
4
5
# File 'lib/turbo/visit/visit.rb', line 3

def delegate
  @delegate
end

#hasCachedSnapshotObject (readonly)

Returns the value of attribute hasCachedSnapshot.



4
5
6
# File 'lib/turbo/visit/visit.rb', line 4

def hasCachedSnapshot
  @hasCachedSnapshot
end

#locationObject (readonly)

Returns the value of attribute location.



4
5
6
# File 'lib/turbo/visit/visit.rb', line 4

def location
  @location
end

#optionsObject (readonly)

Returns the value of attribute options.



4
5
6
# File 'lib/turbo/visit/visit.rb', line 4

def options
  @options
end

#restorationIdentifierObject

Returns the value of attribute restorationIdentifier.



3
4
5
# File 'lib/turbo/visit/visit.rb', line 3

def restorationIdentifier
  @restorationIdentifier
end

#stateObject (readonly)

Returns the value of attribute state.



4
5
6
# File 'lib/turbo/visit/visit.rb', line 4

def state
  @state
end

#visitableObject (readonly)

Returns the value of attribute visitable.



4
5
6
# File 'lib/turbo/visit/visit.rb', line 4

def visitable
  @visitable
end

#webViewObject (readonly)

Returns the value of attribute webView.



4
5
6
# File 'lib/turbo/visit/visit.rb', line 4

def webView
  @webView
end

Instance Method Details

#cancelObject



33
34
35
36
37
38
# File 'lib/turbo/visit/visit.rb', line 33

def cancel
  if state == :started
    @state = :canceled
    cancelVisit
  end
end

#cancelVisitObject



61
# File 'lib/turbo/visit/visit.rb', line 61

def cancelVisit; end

#completeObject



40
41
42
43
44
45
46
47
# File 'lib/turbo/visit/visit.rb', line 40

def complete
  if state == :started
    @state = :completed
    completeVisit
    delegate.visitDidComplete(self) if delegate
    delegate.visitDidFinish(self) if delegate
  end
end

#completeVisitObject



62
# File 'lib/turbo/visit/visit.rb', line 62

def completeVisit; end

#fail(error) ⇒ Object



49
50
51
52
53
54
55
56
57
# File 'lib/turbo/visit/visit.rb', line 49

def fail(error)
  if state == :started
    @state = :failed
    delegate.visit(self, requestDidFailWithError: error) if delegate
    failVisit
    delegate.visitDidFail(self) if delegate
    delegate.visitDidFinish(self) if delegate
  end
end

#failVisitObject



63
# File 'lib/turbo/visit/visit.rb', line 63

def failVisit; end

#initWithVisitable(visitable, options: options, bridge: bridge) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/turbo/visit/visit.rb', line 12

def initWithVisitable(visitable, options: options, bridge: bridge)
  raise visitable.visitableURL.inspect if visitable.visitableURL.is_a?(Hash)# TODO
  raise options.inspect unless options.is_a?(VisitOptions)# TODO
  @visitable = visitable
  @location = visitable.visitableURL
  @options = options
  @bridge = bridge
  @webView = @bridge.webView
  @state = :initialized
  @hasCachedSnapshot = false
  self
end

#startObject



25
26
27
28
29
30
31
# File 'lib/turbo/visit/visit.rb', line 25

def start
  if state == :initialized
    delegate.visitWillStart(self) if delegate
    @state = :started
    startVisit
  end
end

#startVisitObject

Hooks for subclasses



60
# File 'lib/turbo/visit/visit.rb', line 60

def startVisit; end