Class: RedisVars::CLI
- Inherits:
-
Thor
- Object
- Thor
- RedisVars::CLI
show all
- Defined in:
- lib/redis_vars/cli.rb
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(*args) ⇒ Object
50
51
52
53
54
55
56
57
|
# File 'lib/redis_vars/cli.rb', line 50
def method_missing(*args)
if args
args[0] = args[0].to_s
exec(*args)
else
help
end
end
|
Instance Method Details
#add(key, value) ⇒ Object
9
10
11
|
# File 'lib/redis_vars/cli.rb', line 9
def add(key, value)
store.add key, value
end
|
#exec(*args) ⇒ Object
29
30
31
32
33
34
35
36
37
|
# File 'lib/redis_vars/cli.rb', line 29
def exec(*args)
Kernel.exec(store.hash, *args)
rescue Errno::EACCES
puts "Not executable: #{args.first}"
rescue Errno::ENOENT => error
puts error
rescue ArgumentError
puts "redis_vars exec needs a command to run"
end
|
#export ⇒ Object
24
25
26
|
# File 'lib/redis_vars/cli.rb', line 24
def export
puts store.export
end
|
#list ⇒ Object
19
20
21
|
# File 'lib/redis_vars/cli.rb', line 19
def list
puts store.list
end
|
#remove(key) ⇒ Object
14
15
16
|
# File 'lib/redis_vars/cli.rb', line 14
def remove(key)
store.remove key
end
|
#version ⇒ Object
40
41
42
|
# File 'lib/redis_vars/cli.rb', line 40
def version
puts VERSION
end
|