Class: Interfacets::Client::Channels::Url::Builder

Inherits:
Object
  • Object
show all
Defined in:
lib/interfacets/client/channels/url.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize ⇒ Builder

Returns a new instance of Builder.



13
14
15
# File 'lib/interfacets/client/channels/url.rb', line 13

def initialize
  @state = {}
end

Instance Attribute Details

#state ⇒ Object (readonly)

Returns the value of attribute state.



12
13
14
# File 'lib/interfacets/client/channels/url.rb', line 12

def state
  @state
end

Instance Method Details

#path(path, query: {}) ⇒ Object



17
18
19
20
21
22
23
24
25
26
# File 'lib/interfacets/client/channels/url.rb', line 17

def path(path, query: {})
  state[:urlSpec] = {
    url: (
      System
        .current_bus
        .url_for(path)
    ),
    queryParams: query,
  }
end

#redirect(url, query: {}) ⇒ Object



28
29
30
31
# File 'lib/interfacets/client/channels/url.rb', line 28

def redirect(url, query: {})
  @redirected = true
  state[:redirectUrlSpec] = { url:, query: }
end

#redirected? ⇒ Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/interfacets/client/channels/url.rb', line 33

def redirected?
  @redirected
end