Class: Aikido::Zen::AttackWave::Sample

Inherits:
Object
  • Object
show all
Defined in:
lib/aikido/zen/attack_wave.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(verb:, path:) ⇒ Sample

Returns a new instance of Sample.



126
127
128
129
# File 'lib/aikido/zen/attack_wave.rb', line 126

def initialize(verb:, path:)
  @verb = verb
  @path = path
end

Instance Attribute Details

#pathString (readonly)

Returns:

  • (String)


124
125
126
# File 'lib/aikido/zen/attack_wave.rb', line 124

def path
  @path
end

#verbString (readonly)

Returns:

  • (String)


121
122
123
# File 'lib/aikido/zen/attack_wave.rb', line 121

def verb
  @verb
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



138
139
140
141
142
# File 'lib/aikido/zen/attack_wave.rb', line 138

def ==(other)
  other.is_a?(self.class) &&
    other.verb == verb &&
    other.path == path
end

#as_jsonObject



131
132
133
134
135
136
# File 'lib/aikido/zen/attack_wave.rb', line 131

def as_json
  {
    method: @verb.as_json,
    url: @path.as_json
  }.compact
end

#hashObject



145
146
147
# File 'lib/aikido/zen/attack_wave.rb', line 145

def hash
  [verb, path].hash
end