Sha256: 98990bb4c64d8c03e85106e10dedbc1e9c23d73ac55cfed928986b4d2c4dbb45

Contents?: true

Size: 786 Bytes

Versions: 2

Compression:

Stored size: 786 Bytes

Contents

# Require files in your internal folder
require 'ga_example_gem/client'

# This is our GaExampleGem namespace
# for our gem
module GaExampleGem
	class << self
		# Alias for GaExampleGem::Client.new
		def new
      @client ||= GaExampleGem::Client.new
    end

    # Delegate to GaExampleGem::Client
    # This is a weird trick that allows for calling 
    # on methods without calling .new first
    def method_missing(method, *args, &block)
      return super unless new.respond_to?(method)
      new.send(method, *args, &block)
    end


    # This is used for the method_missing to see
    # if a new client would respond to a method
    def respond_to?(method, include_private=false)
      new.respond_to?(method, include_private) || super(method, include_private)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ga_example_gem-0.0.2 lib/ga_example_gem.rb
ga_example_gem-0.0.1 lib/ga_example_gem.rb