Class: Drnbench::RequestResponse::RequestPattern::PatternsGroup
- Inherits:
-
Object
- Object
- Drnbench::RequestResponse::RequestPattern::PatternsGroup
- Defined in:
- lib/drnbench/request-response/request-pattern.rb
Instance Attribute Summary collapse
-
#abstract ⇒ Object
readonly
Returns the value of attribute abstract.
Class Method Summary collapse
Instance Method Summary collapse
- #frequency ⇒ Object
- #host ⇒ Object
-
#initialize(source, abstract) ⇒ PatternsGroup
constructor
A new instance of PatternsGroup.
- #method ⇒ Object
- #patterns ⇒ Object
- #port ⇒ Object
- #timeout ⇒ Object
Constructor Details
#initialize(source, abstract) ⇒ PatternsGroup
Returns a new instance of PatternsGroup.
101 102 103 104 |
# File 'lib/drnbench/request-response/request-pattern.rb', line 101 def initialize(source, abstract) @source = source @abstract = abstract end |
Instance Attribute Details
#abstract ⇒ Object (readonly)
Returns the value of attribute abstract.
99 100 101 |
# File 'lib/drnbench/request-response/request-pattern.rb', line 99 def abstract @abstract end |
Class Method Details
.valid_source?(source) ⇒ Boolean
88 89 90 91 92 93 94 95 96 |
# File 'lib/drnbench/request-response/request-pattern.rb', line 88 def valid_source?(source) if source.is_a?(Array) return Pattern.valid_source?(source.first) end if source.is_a?(Hash) return source.has_key?("patterns") end false end |
Instance Method Details
#frequency ⇒ Object
106 107 108 109 110 111 |
# File 'lib/drnbench/request-response/request-pattern.rb', line 106 def frequency if @source.is_a?(Hash) and @source.has_key?("frequency") return @source["frequency"].to_f end @abstract.default_group_frequency end |
#host ⇒ Object
113 114 115 116 |
# File 'lib/drnbench/request-response/request-pattern.rb', line 113 def host return nil unless @source.is_a?(Hash) @source["host"] end |
#method ⇒ Object
123 124 125 126 |
# File 'lib/drnbench/request-response/request-pattern.rb', line 123 def method return nil unless @source.is_a?(Hash) @source["method"] end |
#patterns ⇒ Object
133 134 135 |
# File 'lib/drnbench/request-response/request-pattern.rb', line 133 def patterns @patterns ||= prepare_patterns end |
#port ⇒ Object
118 119 120 121 |
# File 'lib/drnbench/request-response/request-pattern.rb', line 118 def port return nil unless @source.is_a?(Hash) @source["port"] end |
#timeout ⇒ Object
128 129 130 131 |
# File 'lib/drnbench/request-response/request-pattern.rb', line 128 def timeout return nil unless @source.is_a?(Hash) @source["timeout"] end |