Sha256: fa4ff7e7fe158667f25b6aea509e2dd72579f382c46882050ca49bf89b3c374a
Contents?: true
Size: 669 Bytes
Versions: 1
Compression:
Stored size: 669 Bytes
Contents
module Devrant class Api HTTP_OPTIONS = { query: { app: 3 }, base_uri: 'https://www.devrant.io/api' } def initialize subclasses = { rants: Devrant::Rants, users: Devrant::Users } initialize_subclasses(subclasses) end private def initialize_subclasses(classes) classes.each do |variable, classname| self.instance_variable_set("@#{variable}", classname.new) self.instance_variable_get("@#{variable}").class.default_options = HTTP_OPTIONS self.singleton_class.class_eval do attr_reader variable.to_sym end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
devrant-0.0.2 | lib/devrant/api.rb |