You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While investigating #62, I noticed the API around Launchy#open is inconsistent and yields unexpected results:
Specifying :debug => true does not enable debug output, you must instead specify :debug => 'true' (string vs. bool). In comparison, :dry_run => true does work, as does :dry_run => 'true'.
The following prints [false, true], but I would expect it to print [false, false].
The issue here is that Launchy#dry_run? can return a different type depending on how it was set. It should be consistent and always return a bool regardless of how it was set.
This all makes the API tough to work with, so I'll do the following to fix it while trying to maintain compatibility with existing clients:
Support both true and 'true' for the :debug and :dry_run options.
Always have Launchy#dry_run? check the environment just like Launchy#debug? does.
Launchy#dry_run? and Launchy#debug? will always return boolean values, never strings. This should not affect users doing if Launchy.dry_run? then ... end, but could affect users inspecting the return value on a deeper level (e.g. checking the class). I seriously doubt anyone actually does this, so I think this change is fine.
Let me know if this sounds reasonable and I'll make the changes.
Chris
The text was updated successfully, but these errors were encountered:
While investigating #62, I noticed the API around
Launchy#open
is inconsistent and yields unexpected results:Specifying
:debug => true
does not enable debug output, you must instead specify:debug => 'true'
(string vs. bool). In comparison,:dry_run => true
does work, as does:dry_run => 'true'
.The following prints
[false, true]
, but I would expect it to print[false, false]
.The problem is
Launchy#debug?
checks the environment every time whileLaunchy#dry_run?
does not.The following prints
["true", true, "true"]
, but I would expect it to print[true, true, true]
.The issue here is that
Launchy#dry_run?
can return a different type depending on how it was set. It should be consistent and always return a bool regardless of how it was set.This all makes the API tough to work with, so I'll do the following to fix it while trying to maintain compatibility with existing clients:
true
and'true'
for the:debug
and:dry_run
options.Launchy#dry_run?
check the environment just likeLaunchy#debug?
does.Launchy#dry_run?
andLaunchy#debug?
will always return boolean values, never strings. This should not affect users doingif Launchy.dry_run? then ... end
, but could affect users inspecting the return value on a deeper level (e.g. checking the class). I seriously doubt anyone actually does this, so I think this change is fine.Let me know if this sounds reasonable and I'll make the changes.
Chris
The text was updated successfully, but these errors were encountered: