Module: Sinatra::EngineTracking
- Included in:
- Capture
- Defined in:
- lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/sinatra-contrib-3.0.5/lib/sinatra/engine_tracking.rb
Overview
Adds methods like ‘haml?` that allow helper methods to check whether they are called from within a template.
Instance Attribute Summary collapse
-
#current_engine ⇒ Object
readonly
Returns the value of attribute current_engine.
Instance Method Summary collapse
-
#builder? ⇒ Boolean
Returns true if current engine is ‘:builder`.
-
#erb? ⇒ Boolean
Returns true if current engine is ‘:erb`.
-
#erubi? ⇒ Boolean
Returns true if the current engine is ‘:erubi`, or `Tilt` is set to Tilt::ErubiTemplate.
-
#haml? ⇒ Boolean
Returns true if current engine is ‘:haml`.
- #initialize ⇒ Object
-
#liquid? ⇒ Boolean
Returns true if current engine is ‘:liquid`.
-
#markaby? ⇒ Boolean
Returns true if current engine is ‘:markaby`.
-
#markdown? ⇒ Boolean
Returns true if current engine is ‘:markdown`.
-
#nokogiri? ⇒ Boolean
Returns true if current engine is ‘:nokogiri`.
-
#rdoc? ⇒ Boolean
Returns true if current engine is ‘:rdoc`.
-
#ruby? ⇒ Boolean
Returns true if current engine is ‘:ruby`.
-
#slim? ⇒ Boolean
Returns true if current engine is ‘:slim`.
- #with_engine(engine) ⇒ Object
Instance Attribute Details
#current_engine ⇒ Object (readonly)
Returns the value of attribute current_engine.
9 10 11 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/sinatra-contrib-3.0.5/lib/sinatra/engine_tracking.rb', line 9 def current_engine @current_engine end |
Instance Method Details
#builder? ⇒ Boolean
Returns true if current engine is ‘:builder`.
31 32 33 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/sinatra-contrib-3.0.5/lib/sinatra/engine_tracking.rb', line 31 def builder? @current_engine == :builder end |
#erb? ⇒ Boolean
Returns true if current engine is ‘:erb`.
12 13 14 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/sinatra-contrib-3.0.5/lib/sinatra/engine_tracking.rb', line 12 def erb? @current_engine == :erb end |
#erubi? ⇒ Boolean
Returns true if the current engine is ‘:erubi`, or `Tilt` is set to Tilt::ErubiTemplate.
20 21 22 23 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/sinatra-contrib-3.0.5/lib/sinatra/engine_tracking.rb', line 20 def erubi? @current_engine == :erubi or (erb? && Tilt[:erb] == Tilt::ErubiTemplate) end |
#haml? ⇒ Boolean
Returns true if current engine is ‘:haml`.
26 27 28 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/sinatra-contrib-3.0.5/lib/sinatra/engine_tracking.rb', line 26 def haml? @current_engine == :haml end |
#initialize ⇒ Object
70 71 72 73 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/sinatra-contrib-3.0.5/lib/sinatra/engine_tracking.rb', line 70 def initialize(*) @current_engine = :ruby super end |
#liquid? ⇒ Boolean
Returns true if current engine is ‘:liquid`.
36 37 38 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/sinatra-contrib-3.0.5/lib/sinatra/engine_tracking.rb', line 36 def liquid? @current_engine == :liquid end |
#markaby? ⇒ Boolean
Returns true if current engine is ‘:markaby`.
51 52 53 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/sinatra-contrib-3.0.5/lib/sinatra/engine_tracking.rb', line 51 def markaby? @current_engine == :markaby end |
#markdown? ⇒ Boolean
Returns true if current engine is ‘:markdown`.
41 42 43 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/sinatra-contrib-3.0.5/lib/sinatra/engine_tracking.rb', line 41 def markdown? @current_engine == :markdown end |
#nokogiri? ⇒ Boolean
Returns true if current engine is ‘:nokogiri`.
56 57 58 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/sinatra-contrib-3.0.5/lib/sinatra/engine_tracking.rb', line 56 def nokogiri? @current_engine == :nokogiri end |
#rdoc? ⇒ Boolean
Returns true if current engine is ‘:rdoc`.
46 47 48 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/sinatra-contrib-3.0.5/lib/sinatra/engine_tracking.rb', line 46 def rdoc? @current_engine == :rdoc end |
#ruby? ⇒ Boolean
Returns true if current engine is ‘:ruby`.
66 67 68 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/sinatra-contrib-3.0.5/lib/sinatra/engine_tracking.rb', line 66 def ruby? @current_engine == :ruby end |
#slim? ⇒ Boolean
Returns true if current engine is ‘:slim`.
61 62 63 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/sinatra-contrib-3.0.5/lib/sinatra/engine_tracking.rb', line 61 def slim? @current_engine == :slim end |
#with_engine(engine) ⇒ Object
76 77 78 79 80 81 82 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/sinatra-contrib-3.0.5/lib/sinatra/engine_tracking.rb', line 76 def with_engine(engine) engine_was = @current_engine @current_engine = engine.to_sym yield ensure @current_engine = engine_was end |