aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorJack Nagel2013-01-23 00:26:22 -0600
committerJack Nagel2013-01-26 11:37:01 -0600
commita5471a0cb0f461600bc9bfb9f9feb3825c124b84 (patch)
treec1e262bcd5b80f96b6d967b29c37224e150cb3ee /Library
parentf3d3bc436829b5e9212e052cec50cded80cea2df (diff)
downloadbrew-a5471a0cb0f461600bc9bfb9f9feb3825c124b84.tar.bz2
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.
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/formula_support.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/Library/Homebrew/formula_support.rb b/Library/Homebrew/formula_support.rb
index 9f30afbf7..caf82f765 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