lib/sugar-high/alias.rb in sugar-high-0.1.6 vs lib/sugar-high/alias.rb in sugar-high-0.1.7
- old
+ new
@@ -50,9 +50,16 @@
raise ArgumentError, "Error creating alias for ##{original_name} with ##{new_alias}"
end
end
end
+ def alias_for(original, *aliases)
+ aliases.each do |alias_meth|
+ class_eval "alias_method :#{alias_meth}, :#{original} if respond_to? :#{original}"
+ end
+ end
+ alias_method :aliases_for, :alias_for
+
protected
def make_name name, alias_name, config_options
return alias_name.gsub(/X/, name.to_s) if alias_name =~ /X/
case config_options
\ No newline at end of file