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.
This commit is contained in:
parent
f3d3bc4368
commit
a5471a0cb0
@ -172,6 +172,11 @@ class Option
|
|||||||
@flag = '--'+name.to_s
|
@flag = '--'+name.to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def to_s
|
||||||
|
flag
|
||||||
|
end
|
||||||
|
alias_method :to_str, :to_s
|
||||||
|
|
||||||
def eql?(other)
|
def eql?(other)
|
||||||
@name == other.name
|
@name == other.name
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user