Class: Twirp::Rails::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/twirp/rails/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



24
25
26
27
28
29
30
# File 'lib/twirp/rails/configuration.rb', line 24

def initialize
  @auto_mount = false
  @endpoint = "/twirp"
  @load_paths = ["lib"]
  @middleware = []
  @service_hooks = {}
end

Instance Attribute Details

#auto_mountObject

Whether to automatically mount routes at endpoint. Defaults to false



7
8
9
# File 'lib/twirp/rails/configuration.rb', line 7

def auto_mount
  @auto_mount
end

#endpointObject

Where to mount twirp routes. Defaults to /twirp



10
11
12
# File 'lib/twirp/rails/configuration.rb', line 10

def endpoint
  @endpoint
end

#load_pathsObject

An array of directories to search for *_twirp.rb files Defaults to [“lib”]



14
15
16
# File 'lib/twirp/rails/configuration.rb', line 14

def load_paths
  @load_paths
end

#middlewareObject

An array of Rack middleware to use



17
18
19
# File 'lib/twirp/rails/configuration.rb', line 17

def middleware
  @middleware
end

#service_hooksObject

A hash of lambdas that accepts |rack_env, env| and is passed to Twirp::Service See: github.com/twitchtv/twirp-ruby/wiki/Service-Hooks for available hooks



22
23
24
# File 'lib/twirp/rails/configuration.rb', line 22

def service_hooks
  @service_hooks
end