Class: FSSM::Path
- Inherits:
-
Object
- Object
- FSSM::Path
- Defined in:
- lib/fssm/path.rb
Instance Method Summary collapse
- #create(callback_or_path = nil, &block) ⇒ Object
- #delete(callback_or_path = nil, &block) ⇒ Object
- #glob(value = nil) ⇒ Object
-
#initialize(path = nil, glob = nil, &block) ⇒ Path
constructor
A new instance of Path.
- #to_pathname ⇒ Object
- #to_s ⇒ Object
- #update(callback_or_path = nil, &block) ⇒ Object
Constructor Details
#initialize(path = nil, glob = nil, &block) ⇒ Path
Returns a new instance of Path.
2 3 4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/fssm/path.rb', line 2 def initialize(path=nil, glob=nil, &block) set_path(path || '.') set_glob(glob || '**/*') init_callbacks if block_given? if block.arity == 1 block.call(self) else self.instance_eval(&block) end end end |
Instance Method Details
#create(callback_or_path = nil, &block) ⇒ Object
29 30 31 |
# File 'lib/fssm/path.rb', line 29 def create(callback_or_path=nil, &block) callback_action(:create, (block_given? ? block : callback_or_path)) end |
#delete(callback_or_path = nil, &block) ⇒ Object
37 38 39 |
# File 'lib/fssm/path.rb', line 37 def delete(callback_or_path=nil, &block) callback_action(:delete, (block_given? ? block : callback_or_path)) end |
#glob(value = nil) ⇒ Object
24 25 26 27 |
# File 'lib/fssm/path.rb', line 24 def glob(value=nil) return @glob if value.nil? set_glob(value) end |
#to_pathname ⇒ Object
20 21 22 |
# File 'lib/fssm/path.rb', line 20 def to_pathname @path end |
#to_s ⇒ Object
16 17 18 |
# File 'lib/fssm/path.rb', line 16 def to_s @path.to_s end |
#update(callback_or_path = nil, &block) ⇒ Object
33 34 35 |
# File 'lib/fssm/path.rb', line 33 def update(callback_or_path=nil, &block) callback_action(:update, (block_given? ? block : callback_or_path)) end |