Module: Magicprotorb
- Defined in:
- lib/magicprotorb.rb,
lib/magicprotorb.rb,
lib/magicprotorb/loader.rb,
lib/magicprotorb/naming.rb,
lib/magicprotorb/version.rb,
lib/magicprotorb/registrar.rb,
lib/magicprotorb/include_path.rb,
lib/magicprotorb/require_hook.rb,
lib/magicprotorb/service_builder.rb
Defined Under Namespace
Modules: IncludePath, Loader, Naming, Registrar, RequireHook, ServiceBuilder Classes: CompileError, Error
Constant Summary collapse
- VERSION =
"0.1.0"
Class Method Summary collapse
-
.import(proto) ⇒ Object
Programmatic equivalent of ‘require “magicprotorb/<proto>_pb”`.
-
.import_services(proto) ⇒ Object
Programmatic equivalent of ‘require “magicprotorb/<proto>_services_pb”`.
-
.include_paths ⇒ Object
The include roots currently searched for protos (MAGICPROTORB_PATH then $LOAD_PATH), highest priority first.
- .normalize(proto) ⇒ Object
Class Method Details
.import(proto) ⇒ Object
Programmatic equivalent of ‘require “magicprotorb/<proto>_pb”`. Accepts a canonical proto path with or without the .proto extension.
40 41 42 |
# File 'lib/magicprotorb.rb', line 40 def import(proto) Loader.(normalize(proto)) end |
.import_services(proto) ⇒ Object
Programmatic equivalent of ‘require “magicprotorb/<proto>_services_pb”`.
45 46 47 |
# File 'lib/magicprotorb.rb', line 45 def import_services(proto) Loader.load_services(normalize(proto)) end |
.include_paths ⇒ Object
The include roots currently searched for protos (MAGICPROTORB_PATH then $LOAD_PATH), highest priority first.
34 35 36 |
# File 'lib/magicprotorb.rb', line 34 def include_paths IncludePath.roots end |
.normalize(proto) ⇒ Object
49 50 51 |
# File 'lib/magicprotorb.rb', line 49 def normalize(proto) proto.end_with?(".proto") ? proto : "#{proto}.proto" end |