Class: Aikido::Zen::AttackWave::Sample
- Inherits:
-
Object
- Object
- Aikido::Zen::AttackWave::Sample
- Defined in:
- lib/aikido/zen/attack_wave.rb
Instance Attribute Summary collapse
- #path ⇒ String readonly
- #verb ⇒ String readonly
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #as_json ⇒ Object
- #hash ⇒ Object
-
#initialize(verb:, path:) ⇒ Sample
constructor
A new instance of Sample.
Constructor Details
#initialize(verb:, path:) ⇒ Sample
Returns a new instance of Sample.
162 163 164 165 |
# File 'lib/aikido/zen/attack_wave.rb', line 162 def initialize(verb:, path:) @verb = verb @path = path end |
Instance Attribute Details
#path ⇒ String (readonly)
160 161 162 |
# File 'lib/aikido/zen/attack_wave.rb', line 160 def path @path end |
#verb ⇒ String (readonly)
157 158 159 |
# File 'lib/aikido/zen/attack_wave.rb', line 157 def verb @verb end |
Class Method Details
.from_json(data) ⇒ Object
152 153 154 |
# File 'lib/aikido/zen/attack_wave.rb', line 152 def self.from_json(data) new(verb: data["method"], path: data["url"]) end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
174 175 176 177 178 |
# File 'lib/aikido/zen/attack_wave.rb', line 174 def ==(other) other.is_a?(self.class) && other.verb == verb && other.path == path end |
#as_json ⇒ Object
167 168 169 170 171 172 |
# File 'lib/aikido/zen/attack_wave.rb', line 167 def as_json { "method" => @verb.as_json, "url" => @path.as_json }.compact end |
#hash ⇒ Object
181 182 183 |
# File 'lib/aikido/zen/attack_wave.rb', line 181 def hash [verb, path].hash end |