class ContextStruct
Public Class Methods
new(hash=nil)
click to toggle source
# File lib/thymeleaf/context/context_struct.rb, line 6 def initialize(hash=nil) @table = {} @hash_table = {} if hash && (hash.is_a? Hash) hash.each do |k,v| if v.is_a?(Array) other = Array.new v.each do |entry| other.push((entry.is_a?(Hash) ? self.class.new(entry) : entry)) end v = other end @table[k.to_sym] = (v.is_a?(Hash) ? self.class.new(v) : v) @hash_table[k.to_sym] = v new_ostruct_member(k) end end end
Public Instance Methods
get_private(private_var)
click to toggle source
# File lib/thymeleaf/context/context_struct.rb, line 34 def get_private(private_var) send(:"\##{private_var}") end
has_private(private_var)
click to toggle source
# File lib/thymeleaf/context/context_struct.rb, line 38 def has_private(private_var) begin !(get_private private_var).nil? rescue false end end
set_private(private_var, value)
click to toggle source
# File lib/thymeleaf/context/context_struct.rb, line 29 def set_private(private_var, value) value = ContextStruct.new(value) if value.is_a? Hash send(:"\##{private_var}=", value) end
to_h()
click to toggle source
# File lib/thymeleaf/context/context_struct.rb, line 46 def to_h @hash_table end