Class: FSSM::Tree::Node

Inherits:
Object
  • Object
show all
Includes:
NodeBase, NodeEnumerable
Defined in:
lib/fssm/tree.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from NodeEnumerable

#each

Methods included from NodeBase

#initialize

Instance Attribute Details

#ftypeObject

Returns the value of attribute ftype.



122
123
124
# File 'lib/fssm/tree.rb', line 122

def ftype
  @ftype
end

#mtimeObject

Returns the value of attribute mtime.



121
122
123
# File 'lib/fssm/tree.rb', line 121

def mtime
  @mtime
end

Instance Method Details

#<=>(other) ⇒ Object



124
125
126
127
# File 'lib/fssm/tree.rb', line 124

def <=>(other)
  return unless other.is_a?(::FSSM::Tree::Node)
  self.mtime <=> other.mtime
end

#from_path(path) ⇒ Object



129
130
131
132
133
134
135
136
# File 'lib/fssm/tree.rb', line 129

def from_path(path)
  path = FSSM::Pathname.for(path)
  @ftype = path.ftype
  # this handles bad symlinks without failing. why handle bad symlinks at
  # all? well, we could still be interested in their creation and deletion.
  @mtime = path.symlink? ? Time.at(0) : path.mtime
  self
end