Module: TypstRails::FrameworkDetection

Defined in:
lib/typst_rails/framework_detection.rb

Overview

Detects which web framework (if any) is currently loaded

Class Method Summary collapse

Class Method Details

.detected_frameworkObject



18
19
20
21
22
23
24
# File 'lib/typst_rails/framework_detection.rb', line 18

def self.detected_framework
  return :rails if rails?
  return :rage if rage?
  return :sinatra if sinatra?

  nil
end

.rage?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/typst_rails/framework_detection.rb', line 10

def self.rage?
  defined?(::Rage::Application)
end

.rails?Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/typst_rails/framework_detection.rb', line 6

def self.rails?
  defined?(::Rails) && ::Rails.respond_to?(:application)
end

.sinatra?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/typst_rails/framework_detection.rb', line 14

def self.sinatra?
  defined?(::Sinatra::Base)
end