Class: CouchDocs::CommandLine
- Inherits:
-
Object
- Object
- CouchDocs::CommandLine
- Defined in:
- lib/couch_docs/command_line.rb
Instance Attribute Summary collapse
-
#command ⇒ Object
Returns the value of attribute command.
-
#options ⇒ Object
Returns the value of attribute options.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(args) ⇒ CommandLine
constructor
A new instance of CommandLine.
- #run ⇒ Object
Constructor Details
#initialize(args) ⇒ CommandLine
Returns a new instance of CommandLine.
9 10 11 12 |
# File 'lib/couch_docs/command_line.rb', line 9 def initialize(args) @command = args.shift = args end |
Instance Attribute Details
#command ⇒ Object
Returns the value of attribute command.
7 8 9 |
# File 'lib/couch_docs/command_line.rb', line 7 def command @command end |
#options ⇒ Object
Returns the value of attribute options.
7 8 9 |
# File 'lib/couch_docs/command_line.rb', line 7 def end |
Class Method Details
.run(*args) ⇒ Object
3 4 5 |
# File 'lib/couch_docs/command_line.rb', line 3 def self.run(*args) CommandLine.new(*args).run end |
Instance Method Details
#run ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/couch_docs/command_line.rb', line 14 def run case command when "dump" CouchDocs.dump(*) when "load" CouchDocs.put_document_dir(*.reverse) when "help", "--help", "-h" puts "#{$0} load dir couchdb_uri" puts "#{$0} dump couchdb_uri dir" else raise ArgumentError.new("Unknown command #{command}") end end |