Class: EDI::ArrayResponder

Inherits:
Object
  • Object
show all
Defined in:
lib/edi/utilities/array_responder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ ArrayResponder

Returns a new instance of ArrayResponder.



5
6
7
# File 'lib/edi/utilities/array_responder.rb', line 5

def initialize(response)
  @response = response
end

Instance Attribute Details

#responseObject

Returns the value of attribute response.



3
4
5
# File 'lib/edi/utilities/array_responder.rb', line 3

def response
  @response
end

Instance Method Details

#respondObject



9
10
11
12
13
14
# File 'lib/edi/utilities/array_responder.rb', line 9

def respond
  case response
  when String then [response]
  when Array then response
  end.sample
end