Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
Jack Nagel authored

Showing 1 changed file with 5 additions and 0 deletions. Show diff stats Hide diff stats

  1. +5 0 Library/Homebrew/formula_support.rb
5 Library/Homebrew/formula_support.rb
@@ -172,6 +172,11 @@ def initialize name, description=nil
172 172 @flag = '--'+name.to_s
173 173 end
174 174
  175 + def to_s
  176 + flag
  177 + end
  178 + alias_method :to_str, :to_s
  179 +
175 180 def eql?(other)
176 181 @name == other.name
177 182 end

0 comments on commit 56f72c4

Please sign in to comment.
Something went wrong with that request. Please try again.