Class: Pinot::JsonNumber

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

Overview

Mirrors Go’s json.Number — stores the raw string representation of a JSON number.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw) ⇒ JsonNumber

Returns a new instance of JsonNumber.



14
15
16
# File 'lib/pinot/response.rb', line 14

def initialize(raw)
  @raw = raw.to_s
end

Instance Attribute Details

#rawObject (readonly)

Returns the value of attribute raw.



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

def raw
  @raw
end

Instance Method Details

#==(other) ⇒ Object



22
23
24
25
26
27
# File 'lib/pinot/response.rb', line 22

def ==(other)
  case other
  when JsonNumber then @raw == other.raw
  else false
  end
end

#to_sObject



18
19
20
# File 'lib/pinot/response.rb', line 18

def to_s
  @raw
end