Class: PryPipeline::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/pry-pipeline/response.rb

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ Response

Returns a new instance of Response.



5
6
7
# File 'lib/pry-pipeline/response.rb', line 5

def initialize(response)
  @response = response
end

Instance Method Details

#to_sObject



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/pry-pipeline/response.rb', line 9

def to_s
  case @response
  when Hash
    h = @response.to_hash
    h.keys.map { |key| "#{key} #{h[key]}" }.join("\n")
  when Array
    @response.to_a.join("\n")
  when String, Symbol
    @response.to_s
  else
    @response
  end
end