Module: PandaPal::Concerns::AbilityHelper
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/panda_pal/concerns/ability_helper.rb
Instance Method Summary collapse
- #cache_on_session(*args, **kwargs, &blk) ⇒ Object
- #is_lti_launch? ⇒ Boolean
-
#panda_pal_session ⇒ Object
PandaPal::Session.
- #rails_session ⇒ Object
Instance Method Details
#cache_on_session(*args, **kwargs, &blk) ⇒ Object
38 39 40 |
# File 'lib/panda_pal/concerns/ability_helper.rb', line 38 def cache_on_session(*args, **kwargs, &blk) panda_pal_session.cache(*args, **kwargs, &blk) end |
#is_lti_launch? ⇒ Boolean
34 35 36 |
# File 'lib/panda_pal/concerns/ability_helper.rb', line 34 def is_lti_launch? panda_pal_session.present? end |
#panda_pal_session ⇒ Object
Returns PandaPal::Session.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/panda_pal/concerns/ability_helper.rb', line 8 def panda_pal_session unless defined?(@panda_pal_session) || @controller.present? || method(:panda_pal_session).owner == PandaPal::Concerns::AbilityHelper raise "Ability class needs to set @panda_pal_session or @controller to use this feature" end @panda_pal_session = @controller.current_session(create_missing: false) unless defined?(@panda_pal_session) if @panda_pal_session.is_a?(Hash) # This is a breaking-change to CanvasSync, but not to PandaPal raise "Ability#panda_pal_session/@panda_pal_session should now return a PandaPal::Session object, not a Hash" end @panda_pal_session end |
#rails_session ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/panda_pal/concerns/ability_helper.rb', line 23 def rails_session unless defined?(@rails_session) || @controller.present? || method(:rails_session).owner == PandaPal::Concerns::AbilityHelper raise "Ability class needs to set @rails_session or @controller to use this feature" end @rails_session ||= @controller.session unless defined?(@rails_session) end |