Class: Phenomenal::Context

Inherits:
Object
  • Object
show all
Defined in:
lib/phenomenal_rails/context.rb

Overview

Add persistent attribute to the context class, allowing to disable auto deactivation between HTTP requests

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#persistentObject

Returns the value of attribute persistent.



4
5
6
# File 'lib/phenomenal_rails/context.rb', line 4

def persistent
  @persistent
end

Instance Method Details

#is_persistentObject

DSL inside context definition



6
7
8
9
10
# File 'lib/phenomenal_rails/context.rb', line 6

def is_persistent
  @persistent  = true
  activate
  nil
end

#to_pathObject



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/phenomenal_rails/context.rb', line 12

def to_path
  if name
    name.to_s.underscore
  elsif self==manager.default_feature
    nil
  elsif manager.combined_contexts[self]
     manager.combined_contexts[self].flatten.join("/").underscore
  else
    nil
  end
end