Class: OsCtld::SendReceive::KeyChain::Key
- Inherits:
-
Object
- Object
- OsCtld::SendReceive::KeyChain::Key
- Defined in:
- lib/osctld/send_receive/key_chain.rb
Instance Attribute Summary collapse
-
#ctid ⇒ Object
readonly
Returns the value of attribute ctid.
-
#from ⇒ Object
readonly
Returns the value of attribute from.
-
#in_use ⇒ Object
Returns the value of attribute in_use.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#passphrase ⇒ Object
readonly
Returns the value of attribute passphrase.
-
#pubkey ⇒ Object
readonly
Returns the value of attribute pubkey.
-
#single_use ⇒ Object
readonly
Returns the value of attribute single_use.
Class Method Summary collapse
Instance Method Summary collapse
- #dump ⇒ Object
- #in_use? ⇒ Boolean
-
#initialize(name, pubkey, opts = {}) ⇒ Key
constructor
A new instance of Key.
- #single_use? ⇒ Boolean
Constructor Details
#initialize(name, pubkey, opts = {}) ⇒ Key
Returns a new instance of Key.
22 23 24 25 26 27 28 29 30 |
# File 'lib/osctld/send_receive/key_chain.rb', line 22 def initialize(name, pubkey, opts = {}) @name = name @pubkey = pubkey @from = opts[:from] && opts[:from].split(',') @ctid = opts[:ctid] @passphrase = opts[:passphrase] @single_use = opts[:single_use] @in_use = opts[:in_use] || false end |
Instance Attribute Details
#ctid ⇒ Object (readonly)
Returns the value of attribute ctid.
19 20 21 |
# File 'lib/osctld/send_receive/key_chain.rb', line 19 def ctid @ctid end |
#from ⇒ Object (readonly)
Returns the value of attribute from.
19 20 21 |
# File 'lib/osctld/send_receive/key_chain.rb', line 19 def from @from end |
#in_use ⇒ Object
Returns the value of attribute in_use.
20 21 22 |
# File 'lib/osctld/send_receive/key_chain.rb', line 20 def in_use @in_use end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
19 20 21 |
# File 'lib/osctld/send_receive/key_chain.rb', line 19 def name @name end |
#passphrase ⇒ Object (readonly)
Returns the value of attribute passphrase.
19 20 21 |
# File 'lib/osctld/send_receive/key_chain.rb', line 19 def passphrase @passphrase end |
#pubkey ⇒ Object (readonly)
Returns the value of attribute pubkey.
19 20 21 |
# File 'lib/osctld/send_receive/key_chain.rb', line 19 def pubkey @pubkey end |
#single_use ⇒ Object (readonly)
Returns the value of attribute single_use.
19 20 21 |
# File 'lib/osctld/send_receive/key_chain.rb', line 19 def single_use @single_use end |
Class Method Details
.load(hash) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/osctld/send_receive/key_chain.rb', line 7 def self.load(hash) new( hash['name'], hash['pubkey'], from: hash['from'], ctid: hash['ctid'], passphrase: hash['passphrase'], single_use: hash['single_use'], in_use: hash['in_use'] ) end |
Instance Method Details
#dump ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/osctld/send_receive/key_chain.rb', line 40 def dump { 'name' => name, 'pubkey' => pubkey, 'from' => from && from.join(','), 'ctid' => ctid, 'passphrase' => passphrase, 'single_use' => single_use, 'in_use' => in_use } end |
#in_use? ⇒ Boolean
36 37 38 |
# File 'lib/osctld/send_receive/key_chain.rb', line 36 def in_use? in_use end |
#single_use? ⇒ Boolean
32 33 34 |
# File 'lib/osctld/send_receive/key_chain.rb', line 32 def single_use? single_use end |