You may first put "def scrub_attributes...end" within "class Hash; ...; end" (together with a modified "self.each do |key, value|..."). Then you can use "puts anykindofhash.scrub_attributes".
A way to make a hash an editable variable within a class is to use "def initialize":
by Jo — Nov 01
A way to make a hash an editable variable within a class is to use "def initialize":
class HashOfNames;
def hashofnames; @hashofnames; end;
def initialize; @hashofnames = {"firstname" => " lastname"}; end;
end;
edit = HashOfNames.new;
p a = edit.hashofnames;
p a.scrub_attributes;
p a
(You may also use @@hashofnames in class HashOfNames)