Class: FSSM::State::Directory

Inherits:
Object
  • Object
show all
Defined in:
lib/fssm/state/directory.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path, options = {}) ⇒ Directory

Returns a new instance of Directory.


5
6
7
8
9
# File 'lib/fssm/state/directory.rb', line 5

def initialize(path, options={})
  @path    = path
  @options = options
  @cache   = FSSM::Tree::Cache.new
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path


3
4
5
# File 'lib/fssm/state/directory.rb', line 3

def path
  @path
end

Instance Method Details

#refresh(base = nil, skip_callbacks = false) ⇒ Object


11
12
13
14
15
16
17
18
19
20
# File 'lib/fssm/state/directory.rb', line 11

def refresh(base=nil, skip_callbacks=false)
  base_path = FSSM::Pathname.for(base || @path.to_pathname).expand_path
  previous, current = recache(base_path)

  unless skip_callbacks
    deleted(previous, current)
    created(previous, current)
    modified(previous, current)
  end
end