Class: Kumonos::Routes::Vhost
- Inherits:
-
Struct
- Object
- Struct
- Kumonos::Routes::Vhost
- Defined in:
- lib/kumonos/routes.rb
Instance Attribute Summary collapse
-
#domains ⇒ Object
Returns the value of attribute domains.
-
#name ⇒ Object
Returns the value of attribute name.
-
#routes ⇒ Object
Returns the value of attribute routes.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#domains ⇒ Object
Returns the value of attribute domains
13 14 15 |
# File 'lib/kumonos/routes.rb', line 13 def domains @domains end |
#name ⇒ Object
Returns the value of attribute name
13 14 15 |
# File 'lib/kumonos/routes.rb', line 13 def name @name end |
#routes ⇒ Object
Returns the value of attribute routes
13 14 15 |
# File 'lib/kumonos/routes.rb', line 13 def routes @routes end |
Class Method Details
.build(h) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/kumonos/routes.rb', line 15 def build(h) name = h.fetch('name') cluster_name = h.fetch('cluster_name') host_header = h['host_header'] routes = h.fetch('routes').map { |r| Route.build(r, cluster_name, host_header) } new(name, [name], routes) end |
Instance Method Details
#to_h ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/kumonos/routes.rb', line 24 def to_h h = super h[:routes] = routes.flat_map do |r| # i.e. retry with gRPC request (HTTP POST) if r.method [r.to_h_with_retry] else [r.to_h_with_retry, r.to_h] end end h end |