Module: TwirpRails::Twirp

Defined in:
lib/twirp_rails/twirp.rb

Class Method Summary collapse

Class Method Details

.auto_require_twirp_files(twirp_path) ⇒ Object



3
4
5
6
7
8
9
10
# File 'lib/twirp_rails/twirp.rb', line 3

def self.auto_require_twirp_files(twirp_path)
  # protoc generates require without path in a _pb files
  $LOAD_PATH.unshift(twirp_path) unless $LOAD_PATH.include?(twirp_path)

  Dir.glob(Rails.root.join(twirp_path, '**/*_twirp.rb')).sort.each do |file|
    require file
  end
end