src/functions/questions_handler.rb
def parse_number(body)
  if body
    begin
      data = JSON.parse(body)
      if data.key?('size')
        data['size'].to_i
      else
        nil
      end
    rescue JSON::ParseError
      nil
    end
  else
    nil
  end
end
# Function for obtaining the number in a body
Function for obtaining the number in a body
Function for obtaining the number in a body
def parse_number(body)
  if body
    begin
      data = JSON.parse(body)
      if data.key?('size')
        data['size'].to_i
      else
        nil
      end
    rescue JSON::ParseError
      nil
    end
  else
    nil
  end
end
def parse_number ( body ) if body begin data = JSON . parse ( body ) if data . key? ( 'size' ) data [ 'size' ] . to_i else nil end rescue JSON :: ParseError nil end else nil end end
Function for obtaining the number in a body
Function for obtaining the number in a body
body