Sha256: a0e1dd73cf99e40600d4d39f0509f0330bb298fe48af1a8f4ae83fa12e339874
Contents?: true
Size: 1.01 KB
Versions: 3
Compression:
Stored size: 1.01 KB
Contents
module Personify # This specifies the context we can evaluate in class Context class << self def allowed_context_methods @allowed_methods ||= [] end def context_method(method_name) self.allowed_context_methods << method_name.to_s if self.instance_methods.include?(method_name.to_s) end def allow_method?(method_name) self.allowed_context_methods.include?(method_name.to_s) end end def allow_method?(method_name) self.class.allow_method?(method_name) end def local_assigns=(assigns) @local_assigns = assigns end def local_assigns @local_assigns ||= {} end def [](k) self.local_assigns[k] end def has_key?(k) self.local_assigns.has_key?(k) end end class DefaultContext < Context def if(statement, value) if statement value else nil end end context_method :if end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
personify-1.1.1 | lib/personify/context.rb |
personify-1.1.0 | lib/personify/context.rb |
personify-1.0.0 | lib/personify/context.rb |