Sha256: fab4efa35eeebbee225197634c316361b5157ff261b2da4a4df9eb340782161b

Contents?: true

Size: 620 Bytes

Versions: 4

Compression:

Stored size: 620 Bytes

Contents

module Smile
  class Session
    include Singleton
    API = 'HSoqGCJ8ilF42BeThMGDZqqqOgj1eXqN'

    attr_accessor :id, :api_key, :logger_on
    attr_reader :log

    def has_id?
      @id.nil?
    end

    def api_key
      @api_key || API
    end

    def logger
      if( logger_on? )
        @log ||= Logger.new( STDOUT )
        RestClient.log ||= @log  
        @log
      else
        @blank ||= Logger.new nil
        RestClient.log ||= @blank  
        @blank
      end
    end

    def logger_on?
      @logger_on
    end

    def clear_config!
      @api_key, @log, @logger_on = nil,nil,nil
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
smile-0.4.4 lib/smile/session.rb
smile-0.4.3 lib/smile/session.rb
smile-0.4.1 lib/smile/session.rb
smile-0.4.0 lib/smile/session.rb