This class represents an etcd node
rubocop:disable MethodLength
# File lib/etcd/node.rb, line 12 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
# File lib/etcd/node.rb, line 28 def <=>(other) key <=> other.key end
# File lib/etcd/node.rb, line 32 def children if directory? @children ||= [] else fail 'This is not a directory, cant have children' end end
# File lib/etcd/node.rb, line 40 def directory? ! @dir.nil? end