Module: GaExampleGem

Defined in:
lib/ga_example_gem.rb,
lib/ga_example_gem/client.rb,
lib/ga_example_gem/version.rb,
lib/ga_example_gem/configuration.rb

Overview

This is our GaExampleGem namespace for our gem

Defined Under Namespace

Modules: Configuration Classes: Client

Constant Summary collapse

VERSION =

This sets the version of our gem Its a bit complex, but check out Semantic Versionining semver.org/

"0.0.4"

Class Method Summary collapse

Class Method Details

.method_missing(method, *args, &block) ⇒ Object

Delegate to GaExampleGem::Client This is a weird trick that allows for calling on methods without calling .new first



20
21
22
23
24
# File 'lib/ga_example_gem.rb', line 20

def method_missing(method, *args, &block)
  # Normally this raises an error
  return super unless new.respond_to?(method)
  new.send(method, *args, &block)
end

.newObject

Alias for GaExampleGem::Client.new



13
14
15
# File 'lib/ga_example_gem.rb', line 13

def new
  @client ||= GaExampleGem::Client.new
end

.respond_to?(method, include_private = false) ⇒ Boolean

This is used for the method_missing to see if a new client would respond to a method

Returns:

  • (Boolean)


29
30
31
# File 'lib/ga_example_gem.rb', line 29

def respond_to?(method, include_private=false)
  new.respond_to?(method, include_private) || super(method, include_private)
end