Class: Solr::Response::Header

Inherits:
Object
  • Object
show all
Defined in:
lib/solr/response/header.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status:, time: 0) ⇒ Header

Returns a new instance of Header.



6
7
8
9
10
# File 'lib/solr/response/header.rb', line 6

def initialize(status:, time: 0)
  @status = status
  @time = time
  freeze
end

Instance Attribute Details

#statusObject (readonly)

Returns the value of attribute status.



4
5
6
# File 'lib/solr/response/header.rb', line 4

def status
  @status
end

#timeObject (readonly)

Returns the value of attribute time.



4
5
6
# File 'lib/solr/response/header.rb', line 4

def time
  @time
end

Instance Method Details

#inspectObject



16
17
18
19
20
21
22
# File 'lib/solr/response/header.rb', line 16

def inspect
  if ok?
    'OK'
  else
    status.to_s
  end
end

#ok?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/solr/response/header.rb', line 12

def ok?
  status.zero?
end