Module: VivlioStarter::Pdf
- Defined in:
- lib/vivlio_starter/cli/pdf/provider.rb,
lib/vivlio_starter/cli/pdf/jpeg_to_pdf.rb,
lib/vivlio_starter/cli/pdf/pdf_to_jpeg.rb,
lib/vivlio_starter/cli/pdf/standard_provider.rb
Defined Under Namespace
Modules: JpegToPdf, PdfToJpeg Classes: StandardProvider
Constant Summary collapse
- PLUGIN_GEM_NAME =
拡張プラグイン(vivlio-starter-pdf)の gem 名
'vivlio-starter-pdf'- ENHANCED_PROVIDER_FEATURE =
拡張プロバイダの require パス(feature 名)
'vivlio_starter/cli/pdf/enhanced_provider'
Class Method Summary collapse
-
.build_provider ⇒ StandardProvider, EnhancedProvider
判定したモードに応じてプロバイダを生成する。.
-
.detect_mode ⇒ :disabled, ...
動作モードを判定する。 - VIVLIO_PDF_PLUGIN=disable が指定されていれば常に :disabled - 拡張プロバイダをロードできれば :enhanced - それ以外は :standard.
-
.provider ⇒ StandardProvider, EnhancedProvider
プロバイダのインスタンスを返す(シングルトン).
Class Method Details
.build_provider ⇒ StandardProvider, EnhancedProvider
判定したモードに応じてプロバイダを生成する。
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/vivlio_starter/cli/pdf/provider.rb', line 19 def build_provider case detect_mode in :enhanced announce_mode(:enhanced) EnhancedProvider.new in :disabled | :standard => mode announce_mode(mode) require_relative 'standard_provider' StandardProvider.new end end |
.detect_mode ⇒ :disabled, ...
動作モードを判定する。
- VIVLIO_PDF_PLUGIN=disable が指定されていれば常に :disabled
- 拡張プロバイダをロードできれば :enhanced
- それ以外は :standard
36 37 38 39 40 |
# File 'lib/vivlio_starter/cli/pdf/provider.rb', line 36 def detect_mode return :disabled if ENV['VIVLIO_PDF_PLUGIN'] == 'disable' load_enhanced_provider? ? :enhanced : :standard end |
.provider ⇒ StandardProvider, EnhancedProvider
プロバイダのインスタンスを返す(シングルトン)
15 |
# File 'lib/vivlio_starter/cli/pdf/provider.rb', line 15 def provider = @provider ||= build_provider |