Class: OsCtld::SendReceive::Log::Options

Inherits:
Object
  • Object
show all
Defined in:
lib/osctld/send_receive/log.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ Options

Returns a new instance of Options.

Parameters:

  • opts (Hash)

Options Hash (opts):

  • :ctid (String)
  • :port (Integer)
  • :dst (String)
  • :cloned (Boolean, nil)

Raises:

  • (ArgumentError)


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

#clonedBoolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/osctld/send_receive/log.rb', line 26

def cloned
  @cloned
end

#ctidString (readonly)

Returns:

  • (String)


17
18
19
# File 'lib/osctld/send_receive/log.rb', line 17

def ctid
  @ctid
end

#dstString (readonly)

Returns:

  • (String)


23
24
25
# File 'lib/osctld/send_receive/log.rb', line 23

def dst
  @dst
end

#from_snapshotString? (readonly)

Returns:

  • (String, nil)


35
36
37
# File 'lib/osctld/send_receive/log.rb', line 35

def from_snapshot
  @from_snapshot
end

#key_nameString (readonly)

Returns:

  • (String)


29
30
31
# File 'lib/osctld/send_receive/log.rb', line 29

def key_name
  @key_name
end

#portInteger (readonly)

Returns:

  • (Integer)


20
21
22
# File 'lib/osctld/send_receive/log.rb', line 20

def port
  @port
end

#preexisting_datasetsBoolean (readonly)

Returns:

  • (Boolean)


38
39
40
# File 'lib/osctld/send_receive/log.rb', line 38

def preexisting_datasets
  @preexisting_datasets
end

#snapshotsBoolean (readonly)

Returns:

  • (Boolean)


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

Parameters:

  • opt (Symbol)


61
62
63
# File 'lib/osctld/send_receive/log.rb', line 61

def [](opt)
  instance_variable_get(:"@#{opt}")
end

#cloned?Boolean

Returns:

  • (Boolean)


65
66
67
# File 'lib/osctld/send_receive/log.rb', line 65

def cloned?
  cloned ? true : false
end

#dumpObject



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