Class: PgSlice::Client
- Inherits:
-
Object
- Object
- PgSlice::Client
- Defined in:
- lib/pgslice.rb
Constant Summary collapse
- SQL_FORMAT =
{ day: "YYYYMMDD", month: "YYYYMM" }
Instance Attribute Summary collapse
-
#arguments ⇒ Object
readonly
Returns the value of attribute arguments.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(args) ⇒ Client
constructor
A new instance of Client.
- #perform ⇒ Object
Constructor Details
#initialize(args) ⇒ Client
Returns a new instance of Client.
17 18 19 20 21 22 |
# File 'lib/pgslice.rb', line 17 def initialize(args) $stdout.sync = true $stderr.sync = true parse_args(args) @command = @arguments.shift end |
Instance Attribute Details
#arguments ⇒ Object (readonly)
Returns the value of attribute arguments.
10 11 12 |
# File 'lib/pgslice.rb', line 10 def arguments @arguments end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
10 11 12 |
# File 'lib/pgslice.rb', line 10 def @options end |
Instance Method Details
#perform ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/pgslice.rb', line 24 def perform return if @exit case @command when "prep" prep when "add_partitions" add_partitions when "fill" fill when "swap" swap when "unswap" unswap when "unprep" unprep when nil log "Commands: add_partitions, fill, prep, swap, unprep, unswap" else abort "Unknown command: #{@command}" end ensure @connection.close if @connection end |