Class: Personify::Context
- Inherits:
-
Object
- Object
- Personify::Context
- Defined in:
- lib/personify/context.rb
Overview
This specifies the context we can evaluate in
Direct Known Subclasses
Class Method Summary collapse
- .allow_method?(method_name) ⇒ Boolean
- .allowed_context_methods ⇒ Object
- .context_method(method_name) ⇒ Object
Instance Method Summary collapse
- #[](k) ⇒ Object
- #allow_method?(method_name) ⇒ Boolean
- #has_key?(k) ⇒ Boolean
- #local_assigns ⇒ Object
- #local_assigns=(assigns) ⇒ Object
Class Method Details
.allow_method?(method_name) ⇒ Boolean
14 15 16 |
# File 'lib/personify/context.rb', line 14 def allow_method?(method_name) self.allowed_context_methods.include?(method_name.to_sym) end |
.allowed_context_methods ⇒ Object
6 7 8 |
# File 'lib/personify/context.rb', line 6 def allowed_context_methods @allowed_methods ||= [] end |
.context_method(method_name) ⇒ Object
10 11 12 |
# File 'lib/personify/context.rb', line 10 def context_method(method_name) self.allowed_context_methods << method_name.to_sym if self.instance_methods.include?(method_name.to_s) || self.instance_methods.include?(method_name.to_sym) end |
Instance Method Details
#[](k) ⇒ Object
31 32 33 |
# File 'lib/personify/context.rb', line 31 def [](k) self.local_assigns[k] end |
#allow_method?(method_name) ⇒ Boolean
19 20 21 |
# File 'lib/personify/context.rb', line 19 def allow_method?(method_name) self.class.allow_method?(method_name) end |
#has_key?(k) ⇒ Boolean
35 36 37 |
# File 'lib/personify/context.rb', line 35 def has_key?(k) self.local_assigns.has_key?(k) end |
#local_assigns ⇒ Object
27 28 29 |
# File 'lib/personify/context.rb', line 27 def local_assigns @local_assigns ||= {} end |
#local_assigns=(assigns) ⇒ Object
23 24 25 |
# File 'lib/personify/context.rb', line 23 def local_assigns=(assigns) @local_assigns = assigns end |