Sha256: 6f7230a2679dfb039d00f13aa7f1409d9faced7d60898b2f4a9998703538123c

Contents?: true

Size: 882 Bytes

Versions: 2

Compression:

Stored size: 882 Bytes

Contents

require 'fb_graph'
require 'facemock/config'
require 'facemock/fb_graph/user'
require 'facemock/fb_graph/application'

module Facemock
  module FbGraph
    extend self

    def on(options={})
      if ::FbGraph != Facemock::FbGraph
        Object.const_set(:SourceFbGraph, ::FbGraph)
        Object.send(:remove_const, :FbGraph) if Object.constants.include?(:FbGraph)
        Object.const_set(:FbGraph, Facemock::FbGraph)
      end
      true
    end

    def off
      if ::FbGraph == Facemock::FbGraph
        Object.send(:remove_const, :FbGraph) if Object.constants.include?(:FbGraph)
        Object.const_set(:FbGraph, ::SourceFbGraph)
        Object.send(:remove_const, :SourceFbGraph) if Object.constants.include?(:FbGraph)
      end
      true
    end

    class InvalidToken < ::FbGraph::InvalidToken; end
    class InvalidRequest < ::FbGraph::InvalidRequest; end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
facemock-0.0.7 lib/facemock/fb_graph.rb
facemock-0.0.6 lib/facemock/fb_graph.rb