Class: OsCtld::SendReceive::Log::Options
- Inherits:
-
Object
- Object
- OsCtld::SendReceive::Log::Options
- Defined in:
- lib/osctld/send_receive/log.rb
Instance Attribute Summary collapse
- #cloned ⇒ Boolean
- #ctid ⇒ String readonly
- #dst ⇒ String readonly
- #from_snapshot ⇒ String? readonly
- #key_name ⇒ String readonly
- #port ⇒ Integer readonly
- #preexisting_datasets ⇒ Boolean readonly
- #snapshots ⇒ Boolean readonly
Class Method Summary collapse
Instance Method Summary collapse
- #[](opt) ⇒ Object
- #cloned? ⇒ Boolean
- #dump ⇒ Object
-
#initialize(opts) ⇒ Options
constructor
A new instance of Options.
Constructor Details
#initialize(opts) ⇒ Options
Returns a new instance of Options.
45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/osctld/send_receive/log.rb', line 45 def initialize(opts) @ctid = opts.delete(:ctid) @port = opts.delete(:port) @dst = opts.delete(:dst) @cloned = opts.delete(:cloned) @key_name = opts.delete(:key_name) @snapshots = opts.delete(:snapshots) @from_snapshot = opts.delete(:from_snapshot) @preexisting_datasets = opts.delete(:preexisting_datasets) return if opts.empty? raise ArgumentError, "unsupported options: #{opts.keys.join(', ')}" end |
Instance Attribute Details
#cloned ⇒ Boolean
26 27 28 |
# File 'lib/osctld/send_receive/log.rb', line 26 def cloned @cloned end |
#ctid ⇒ String (readonly)
17 18 19 |
# File 'lib/osctld/send_receive/log.rb', line 17 def ctid @ctid end |
#dst ⇒ String (readonly)
23 24 25 |
# File 'lib/osctld/send_receive/log.rb', line 23 def dst @dst end |
#from_snapshot ⇒ String? (readonly)
35 36 37 |
# File 'lib/osctld/send_receive/log.rb', line 35 def from_snapshot @from_snapshot end |
#key_name ⇒ String (readonly)
29 30 31 |
# File 'lib/osctld/send_receive/log.rb', line 29 def key_name @key_name end |
#port ⇒ Integer (readonly)
20 21 22 |
# File 'lib/osctld/send_receive/log.rb', line 20 def port @port end |
#preexisting_datasets ⇒ Boolean (readonly)
38 39 40 |
# File 'lib/osctld/send_receive/log.rb', line 38 def preexisting_datasets @preexisting_datasets end |
#snapshots ⇒ Boolean (readonly)
32 33 34 |
# File 'lib/osctld/send_receive/log.rb', line 32 def snapshots @snapshots end |
Class Method Details
.load(cfg) ⇒ Object
12 13 14 |
# File 'lib/osctld/send_receive/log.rb', line 12 def self.load(cfg) new(cfg.transform_keys(&:to_sym)) end |
Instance Method Details
#[](opt) ⇒ Object
61 62 63 |
# File 'lib/osctld/send_receive/log.rb', line 61 def [](opt) instance_variable_get(:"@#{opt}") end |
#cloned? ⇒ Boolean
65 66 67 |
# File 'lib/osctld/send_receive/log.rb', line 65 def cloned? cloned ? true : false end |
#dump ⇒ Object
69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/osctld/send_receive/log.rb', line 69 def dump { 'ctid' => ctid, 'port' => port, 'dst' => dst, 'cloned' => cloned?, 'key_name' => key_name, 'snapshots' => snapshots, 'from_snapshot' => from_snapshot, 'preexisting_datasets' => preexisting_datasets } end |