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
- #key_name ⇒ String readonly
- #port ⇒ Integer 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.
37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/osctld/send_receive/log.rb', line 37 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) unless opts.empty? raise ArgumentError, "unsupported options: #{opts.keys.join(', ')}" end 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)
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 |
#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)
20 21 22 |
# File 'lib/osctld/send_receive/log.rb', line 20 def port @port end |
Class Method Details
.load(cfg) ⇒ Object
12 13 14 |
# File 'lib/osctld/send_receive/log.rb', line 12 def self.load(cfg) new(Hash[cfg.map { |k,v| [k.to_sym, v] }]) end |
Instance Method Details
#[](opt) ⇒ Object
50 51 52 |
# File 'lib/osctld/send_receive/log.rb', line 50 def [](opt) instance_variable_get(:"@#{opt}") end |
#cloned? ⇒ Boolean
54 55 56 |
# File 'lib/osctld/send_receive/log.rb', line 54 def cloned? cloned ? true : false end |
#dump ⇒ Object
58 59 60 61 62 63 64 65 66 |
# File 'lib/osctld/send_receive/log.rb', line 58 def dump { 'ctid' => ctid, 'port' => port, 'dst' => dst, 'cloned' => cloned?, 'key_name' => key_name, } end |