Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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.
  • Loading branch information...
commit 56f72c485353e9de4f2898389dc77a2766e273e4 1 parent 8d0c65e
@jacknagel authored
Showing with 5 additions and 0 deletions.
  1. +5 −0 Library/Homebrew/formula_support.rb
View
5 Library/Homebrew/formula_support.rb
@@ -172,6 +172,11 @@ def initialize name, description=nil
@flag = '--'+name.to_s
end
+ def to_s
+ flag
+ end
+ alias_method :to_str, :to_s
+
def eql?(other)
@name == other.name
end
Please sign in to comment.
Something went wrong with that request. Please try again.