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
- #protocol_version ⇒ Integer 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.
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/osctld/send_receive/log.rb', line 49 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) @protocol_version = opts.delete(:protocol_version) || SendReceive::PROTOCOL_VERSION return if opts.empty? raise ArgumentError, "unsupported options: #{opts.keys.join(', ')}" end |
Instance Attribute Details
#cloned ⇒ Boolean
27 28 29 |
# File 'lib/osctld/send_receive/log.rb', line 27 def cloned @cloned end |
#ctid ⇒ String (readonly)
18 19 20 |
# File 'lib/osctld/send_receive/log.rb', line 18 def ctid @ctid end |
#dst ⇒ String (readonly)
24 25 26 |
# File 'lib/osctld/send_receive/log.rb', line 24 def dst @dst end |
#from_snapshot ⇒ String? (readonly)
36 37 38 |
# File 'lib/osctld/send_receive/log.rb', line 36 def from_snapshot @from_snapshot end |
#key_name ⇒ String (readonly)
30 31 32 |
# File 'lib/osctld/send_receive/log.rb', line 30 def key_name @key_name end |
#port ⇒ Integer (readonly)
21 22 23 |
# File 'lib/osctld/send_receive/log.rb', line 21 def port @port end |
#preexisting_datasets ⇒ Boolean (readonly)
39 40 41 |
# File 'lib/osctld/send_receive/log.rb', line 39 def preexisting_datasets @preexisting_datasets end |
#protocol_version ⇒ Integer (readonly)
42 43 44 |
# File 'lib/osctld/send_receive/log.rb', line 42 def protocol_version @protocol_version end |
#snapshots ⇒ Boolean (readonly)
33 34 35 |
# File 'lib/osctld/send_receive/log.rb', line 33 def snapshots @snapshots end |
Class Method Details
.load(cfg) ⇒ Object
13 14 15 |
# File 'lib/osctld/send_receive/log.rb', line 13 def self.load(cfg) new(cfg.transform_keys(&:to_sym)) end |
Instance Method Details
#[](opt) ⇒ Object
66 67 68 |
# File 'lib/osctld/send_receive/log.rb', line 66 def [](opt) instance_variable_get(:"@#{opt}") end |
#cloned? ⇒ Boolean
70 71 72 |
# File 'lib/osctld/send_receive/log.rb', line 70 def cloned? cloned ? true : false end |
#dump ⇒ Object
74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/osctld/send_receive/log.rb', line 74 def dump { 'ctid' => ctid, 'port' => port, 'dst' => dst, 'cloned' => cloned?, 'key_name' => key_name, 'snapshots' => snapshots, 'from_snapshot' => from_snapshot, 'preexisting_datasets' => preexisting_datasets, 'protocol_version' => protocol_version } end |