lib/pilha/stack_overflow/base.rb in pilha-0.2.0 vs lib/pilha/stack_overflow/base.rb in pilha-0.2.1

- old
+ new

@@ -1,25 +1,25 @@ module StackExchange module StackOverflow class Base class << self - def client - @client ||= StackExchange::StackOverflow::Client.config - end - def parse_with_class(hash, key, klass) case hash[key] - when Hash - hash[key] = klass.new(hash[key]) - when Array - hash[key] = hash[key].map { |value| klass.new(value) } + when Hash + hash[key] = klass.new(hash[key]) + when Array + hash[key] = hash[key].map { |value| klass.new(value) } end end def request(path_pattern, id, options) options.merge! :id => id if id parse client.request(path_pattern, options) + end + + def client + StackExchange::StackOverflow::Client.instance end end def initialize(hash) @struct = OpenStruct.new hash