Module: StateFu::Interface::SoftAlias

Defined in:
lib/interface.rb

Instance Method Summary collapse

Instance Method Details

#soft_alias(hash) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/interface.rb', line 5

def soft_alias(hash)
  existing_method_names = (self.instance_methods | self.protected_instance_methods | self.private_instance_methods).map(&:to_sym)
  hash.each do |original, aliases|
    aliases.
      reject { |a| existing_method_names.include?(a.to_sym) }.
      each { |a| alias_method a, original}
  end
end