Class: OsCtld::LocalTransfer::Log::Options
- Inherits:
-
Object
- Object
- OsCtld::LocalTransfer::Log::Options
- Defined in:
- lib/osctld/local_transfer/log.rb
Instance Attribute Summary collapse
-
#datasets ⇒ Object
readonly
Returns the value of attribute datasets.
-
#network_interfaces ⇒ Object
readonly
Returns the value of attribute network_interfaces.
-
#operation ⇒ Object
readonly
Returns the value of attribute operation.
-
#target_dataset ⇒ Object
readonly
Returns the value of attribute target_dataset.
-
#target_dataset_custom ⇒ Object
readonly
Returns the value of attribute target_dataset_custom.
-
#target_group ⇒ Object
readonly
Returns the value of attribute target_group.
-
#target_id ⇒ Object
readonly
Returns the value of attribute target_id.
-
#target_pool ⇒ Object
readonly
Returns the value of attribute target_pool.
-
#target_user ⇒ Object
readonly
Returns the value of attribute target_user.
Class Method Summary collapse
Instance Method Summary collapse
- #copy? ⇒ Boolean
- #dump ⇒ Object
-
#initialize(opts) ⇒ Options
constructor
A new instance of Options.
- #move? ⇒ Boolean
Constructor Details
#initialize(opts) ⇒ Options
Returns a new instance of Options.
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/osctld/local_transfer/log.rb', line 41 def initialize(opts) opts = opts.dup @operation = opts.delete(:operation).to_sym @target_pool = opts.delete(:target_pool) @target_id = opts.delete(:target_id) @target_dataset = opts.delete(:target_dataset) @target_dataset_custom = opts.delete(:target_dataset_custom) || false @target_user = opts.delete(:target_user) @target_group = opts.delete(:target_group) @network_interfaces = opts.delete(:network_interfaces) @datasets = (opts.delete(:datasets) || []).map do |v| v.is_a?(Dataset) ? v : Dataset.load(v) end return if opts.empty? raise ArgumentError, "unsupported options: #{opts.keys.join(', ')}" end |
Instance Attribute Details
#datasets ⇒ Object (readonly)
Returns the value of attribute datasets.
33 34 35 |
# File 'lib/osctld/local_transfer/log.rb', line 33 def datasets @datasets end |
#network_interfaces ⇒ Object (readonly)
Returns the value of attribute network_interfaces.
33 34 35 |
# File 'lib/osctld/local_transfer/log.rb', line 33 def network_interfaces @network_interfaces end |
#operation ⇒ Object (readonly)
Returns the value of attribute operation.
33 34 35 |
# File 'lib/osctld/local_transfer/log.rb', line 33 def operation @operation end |
#target_dataset ⇒ Object (readonly)
Returns the value of attribute target_dataset.
33 34 35 |
# File 'lib/osctld/local_transfer/log.rb', line 33 def target_dataset @target_dataset end |
#target_dataset_custom ⇒ Object (readonly)
Returns the value of attribute target_dataset_custom.
33 34 35 |
# File 'lib/osctld/local_transfer/log.rb', line 33 def target_dataset_custom @target_dataset_custom end |
#target_group ⇒ Object (readonly)
Returns the value of attribute target_group.
33 34 35 |
# File 'lib/osctld/local_transfer/log.rb', line 33 def target_group @target_group end |
#target_id ⇒ Object (readonly)
Returns the value of attribute target_id.
33 34 35 |
# File 'lib/osctld/local_transfer/log.rb', line 33 def target_id @target_id end |
#target_pool ⇒ Object (readonly)
Returns the value of attribute target_pool.
33 34 35 |
# File 'lib/osctld/local_transfer/log.rb', line 33 def target_pool @target_pool end |
#target_user ⇒ Object (readonly)
Returns the value of attribute target_user.
33 34 35 |
# File 'lib/osctld/local_transfer/log.rb', line 33 def target_user @target_user end |
Class Method Details
.load(cfg) ⇒ Object
37 38 39 |
# File 'lib/osctld/local_transfer/log.rb', line 37 def self.load(cfg) new(cfg.transform_keys(&:to_sym)) end |
Instance Method Details
#copy? ⇒ Boolean
61 62 63 |
# File 'lib/osctld/local_transfer/log.rb', line 61 def copy? operation == :copy end |
#dump ⇒ Object
69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/osctld/local_transfer/log.rb', line 69 def dump { 'operation' => operation.to_s, 'target_pool' => target_pool, 'target_id' => target_id, 'target_dataset' => target_dataset, 'target_dataset_custom' => target_dataset_custom, 'target_user' => target_user, 'target_group' => target_group, 'network_interfaces' => network_interfaces, 'datasets' => datasets.map(&:dump) } end |
#move? ⇒ Boolean
65 66 67 |
# File 'lib/osctld/local_transfer/log.rb', line 65 def move? operation == :move end |