Class: Etcd::Node
Overview
This class represents an etcd node
Instance Attribute Summary collapse
-
#created_index ⇒ Object
(also: #createdIndex)
readonly
Returns the value of attribute created_index.
-
#dir ⇒ Object
readonly
Returns the value of attribute dir.
-
#expiration ⇒ Object
readonly
Returns the value of attribute expiration.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#modified_index ⇒ Object
(also: #modifiedIndex)
readonly
Returns the value of attribute modified_index.
-
#ttl ⇒ Object
readonly
Returns the value of attribute ttl.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #children ⇒ Object
- #directory? ⇒ Boolean
-
#initialize(opts = {}) ⇒ Node
constructor
rubocop:disable MethodLength.
Constructor Details
#initialize(opts = {}) ⇒ Node
rubocop:disable MethodLength
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/etcd/node.rb', line 13 def initialize(opts = {}) @created_index = opts['createdIndex'] @modified_index = opts['modifiedIndex'] @ttl = opts['ttl'] @key = opts['key'] @value = opts['value'] @expiration = opts['expiration'] @dir = opts['dir'] if opts['dir'] && (!!opts['nodes']) opts['nodes'].each do |data| children << Node.new(data) end end end |
Instance Attribute Details
#created_index ⇒ Object (readonly) Also known as: createdIndex
Returns the value of attribute created_index.
8 9 10 |
# File 'lib/etcd/node.rb', line 8 def created_index @created_index end |
#dir ⇒ Object (readonly)
Returns the value of attribute dir.
8 9 10 |
# File 'lib/etcd/node.rb', line 8 def dir @dir end |
#expiration ⇒ Object (readonly)
Returns the value of attribute expiration.
8 9 10 |
# File 'lib/etcd/node.rb', line 8 def expiration @expiration end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
8 9 10 |
# File 'lib/etcd/node.rb', line 8 def key @key end |
#modified_index ⇒ Object (readonly) Also known as: modifiedIndex
Returns the value of attribute modified_index.
8 9 10 |
# File 'lib/etcd/node.rb', line 8 def modified_index @modified_index end |
#ttl ⇒ Object (readonly)
Returns the value of attribute ttl.
8 9 10 |
# File 'lib/etcd/node.rb', line 8 def ttl @ttl end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
8 9 10 |
# File 'lib/etcd/node.rb', line 8 def value @value end |
Instance Method Details
#<=>(other) ⇒ Object
29 30 31 |
# File 'lib/etcd/node.rb', line 29 def <=>(other) key <=> other.key end |
#children ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/etcd/node.rb', line 33 def children if directory? @children ||= [] else fail 'This is not a directory, cant have children' end end |
#directory? ⇒ Boolean
41 42 43 |
# File 'lib/etcd/node.rb', line 41 def directory? !! @dir end |