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 966e3a6

Browse files
add storage to the query runner
1 parent f2e3b13 commit 966e3a6

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

‎lib/amnesia.rb‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
require_relative 'amnesia/cli'
22

3-
Amnesia::CLI.new.start
3+
database_filename = ARGV[0]
4+
5+
raise 'you must select the database filename' if database_filename.nil?
6+
7+
Amnesia::CLI.new(database_filename).start

‎lib/amnesia/query_runner.rb‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
module Amnesia
22
class QueryRunner
3+
def initialize(amnesia_storage)
4+
@amnesia_storage = amnesia_storage
5+
end
6+
37
def run(instruction_keyword, key, value)
48
instruction = instructions_map[instruction_keyword.to_sym]
59
instruction.call(key, value)
@@ -15,11 +19,11 @@ def instructions_map
1519
end
1620

1721
def get(key)
18-
"Getting key#{key}"
22+
@amnesia_storage.get(key)
1923
end
2024

2125
def set(key, value)
22-
"Setting key#{key} to value#{value}"
26+
@amnesia_storage.set(key,value)
2327
end
2428
end
2529
end

0 commit comments

Comments
(0)

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