-
-
Save hinrik/69bbc9feb263f82f830d6233e8abf396 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "option_parser" | |
class Foo | |
@filename : String | |
def initialize(@filename) | |
end | |
end | |
filename = nil | |
#OptionParser.parse! do |parser| | |
# parser.on("-f FILE", "Filename") do |file| | |
# filename = file | |
# end | |
#end | |
if filename | |
# if I uncomment the code above, this fails with: | |
# instance variable '@filename' of Foo must be String, not (String | Nil) | |
Foo.new(filename) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment