Class: Mxup::WaitSpec
- Inherits:
-
Struct
- Object
- Struct
- Mxup::WaitSpec
- Defined in:
- lib/mxup/config.rb
Overview
A readiness check attached to a window.
Constant Summary collapse
- CHECK_TYPES =
%w[tcp http path script].freeze
Instance Attribute Summary collapse
-
#interval ⇒ Object
Returns the value of attribute interval.
-
#label ⇒ Object
Returns the value of attribute label.
-
#target ⇒ Object
Returns the value of attribute target.
-
#timeout ⇒ Object
Returns the value of attribute timeout.
-
#type ⇒ Object
Returns the value of attribute type.
Class Method Summary collapse
Instance Attribute Details
#interval ⇒ Object
Returns the value of attribute interval
210 211 212 |
# File 'lib/mxup/config.rb', line 210 def interval @interval end |
#label ⇒ Object
Returns the value of attribute label
210 211 212 |
# File 'lib/mxup/config.rb', line 210 def label @label end |
#target ⇒ Object
Returns the value of attribute target
210 211 212 |
# File 'lib/mxup/config.rb', line 210 def target @target end |
#timeout ⇒ Object
Returns the value of attribute timeout
210 211 212 |
# File 'lib/mxup/config.rb', line 210 def timeout @timeout end |
#type ⇒ Object
Returns the value of attribute type
210 211 212 |
# File 'lib/mxup/config.rb', line 210 def type @type end |
Class Method Details
.parse(raw) ⇒ Object
213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 |
# File 'lib/mxup/config.rb', line 213 def self.parse(raw) case raw when nil nil when String new(type: :tcp, target: raw, timeout: nil, interval: 2, label: raw) when Hash found = CHECK_TYPES & raw.keys unless found.size == 1 raise ArgumentError, "wait_for must specify exactly one of: #{CHECK_TYPES.join(', ')}" end type = found.first target = raw[type] default_label = type == 'script' ? 'readiness check' : target new( type: type.to_sym, target: target, timeout: raw['timeout'], interval: raw['interval'] || 2, label: raw['label'] || default_label ) else raise ArgumentError, "wait_for must be a string or hash, got #{raw.class}" end end |