Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit a87ca51

Browse files
add new rule to the parser
1 parent 67fe226 commit a87ca51

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

‎lib/amnesia/query_parser.rb‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@ module Amnesia
22
class QueryParser
33
def self.call(raw_command)
44
tokens = raw_command.split(' ')
5+
puts tokens
56

6-
raise 'Unable to parse command' if tokens.size > 3
7+
raise 'Unable to parse command' if tokens.size > 3 || tokens.size < 2
78

8-
tokens
9+
instruction, *rest = tokens
10+
11+
[instruction.downcase, *rest]
912
end
1013
end
1114
end

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /