vendredi 8 mai 2015

What does this code, that looks like JavaScript object do?

@options = { query: {site: service, page: page} }

What does this do? In javascript this, I think would be object definition, however I cannot find what exactly it is in ruby. This would be the full code:

class StackExchange
  include HTTParty
  base_uri 'api.stackexchange.com'

  def initialize(service, page)
    @options = { query: {site: service, page: page} }
  end

  def questions
    self.class.get("/2.2/questions", @options)
  end

  def users
    self.class.get("/2.2/users", @options)
  end
end

Aucun commentaire:

Enregistrer un commentaire