lib/etcd/node.rb in etcd-0.2.0.alpha vs lib/etcd/node.rb in etcd-0.2.0.beta.1
- old
+ new
@@ -1,26 +1,27 @@
# Encoding: utf-8
module Etcd
+ # This class represents an etcd node
class Node
-
include Comparable
attr_reader :created_index, :modified_index, :expiration, :ttl, :key, :value
- alias :createdIndex :created_index
- alias :modifiedIndex :modified_index
+ alias_method :createdIndex, :created_index
+ alias_method :modifiedIndex, :modified_index
- def initialize(opts={})
+ # rubocop:disable MethodLength
+ 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'] and (!!opts['nodes'])
+ if opts['dir'] && (!!opts['nodes'])
opts['nodes'].each do |data|
children << Node.new(data)
end
end
end
@@ -31,10 +32,10 @@
def children
if directory?
@children ||= []
else
- raise "This is not a directory, cant have children"
+ fail 'This is not a directory, cant have children'
end
end
def directory?
!! @dir