From a5471a0cb0f461600bc9bfb9f9feb3825c124b84 Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Wed, 23 Jan 2013 00:26:22 -0600 Subject: [PATCH] Options can be used interchangeably with Strings We want to be able to use Option objects in place of strings and have this be transparent. Defining to_str means that methods like Kernel#system and Kernel#exec will be able to perform an implicit conversion. --- Library/Homebrew/formula_support.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Library/Homebrew/formula_support.rb b/Library/Homebrew/formula_support.rb index 9f30afbf7b..caf82f7651 100644 --- a/Library/Homebrew/formula_support.rb +++ b/Library/Homebrew/formula_support.rb @@ -172,6 +172,11 @@ class Option @flag = '--'+name.to_s end + def to_s + flag + end + alias_method :to_str, :to_s + def eql?(other) @name == other.name end