Skip to content

Instantly share code, notes, and snippets.

@tansaku
Created March 7, 2014 22:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tansaku/9421358 to your computer and use it in GitHub Desktop.
Save tansaku/9421358 to your computer and use it in GitHub Desktop.
class Parser
def initialize(array=nil)
@array = array
end
def hasMoreCommands
!@array.nil? and @array.size > 0
end
end
raise "default parser should not have any commands" if Parser.new().hasMoreCommands == true
raise "parser with data should have commands" if Parser.new(['@7','D=M']).hasMoreCommands == false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment