Class: Hash
- Inherits:
-
Object
show all
- Defined in:
- lib/fleck/hash_with_indifferent_access.rb
Instance Method Summary
collapse
Instance Method Details
#filter! ⇒ Object
73
74
75
76
77
78
79
80
81
82
83
84
|
# File 'lib/fleck/hash_with_indifferent_access.rb', line 73
def filter!
filters = Fleck.config.filters
self.keys.each do |key|
if filters.include?(key.to_s)
self[key] = "[FILTERED]"
elsif self[key].is_a?(Hash)
self[key] = self[key].dup.filter!
end
end
return self
end
|
#filtered! ⇒ Object
65
66
67
68
69
70
71
|
# File 'lib/fleck/hash_with_indifferent_access.rb', line 65
def filtered!
@filtered = true
self.keys.each do |key|
self[key].filtered! if self[key].is_a?(Hash)
end
return self
end
|
#to_hash_with_indifferent_access ⇒ Object
53
54
55
|
# File 'lib/fleck/hash_with_indifferent_access.rb', line 53
def to_hash_with_indifferent_access
return HashWithIndifferentAccess.new(self)
end
|
#to_s ⇒ Object
57
58
59
60
61
62
63
|
# File 'lib/fleck/hash_with_indifferent_access.rb', line 57
def to_s
if @filtered
return self.dup.filter!.inspect
else
super
end
end
|