Class: FSSM::Path
- Inherits:
-
Object
- Object
- FSSM::Path
- Defined in:
- lib/fssm/path.rb
Instance Method Summary collapse
- #create(*args, &block) ⇒ Object
- #delete(*args, &block) ⇒ Object
- #glob(value = nil) ⇒ Object
-
#initialize(path = nil, glob = nil, options = {}, &block) ⇒ Path
constructor
A new instance of Path.
- #to_pathname ⇒ Object
- #to_s ⇒ Object
- #update(*args, &block) ⇒ Object
Constructor Details
#initialize(path = nil, glob = nil, options = {}, &block) ⇒ Path
Returns a new instance of Path.
2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/fssm/path.rb', line 2 def initialize(path=nil, glob=nil, ={}, &block) @options = 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(*args, &block) ⇒ Object
30 31 32 |
# File 'lib/fssm/path.rb', line 30 def create(*args, &block) callback_action(:create, (block_given? ? block : args)) end |
#delete(*args, &block) ⇒ Object
38 39 40 |
# File 'lib/fssm/path.rb', line 38 def delete(*args, &block) callback_action(:delete, (block_given? ? block : args)) end |
#glob(value = nil) ⇒ Object
25 26 27 28 |
# File 'lib/fssm/path.rb', line 25 def glob(value=nil) return @glob if value.nil? set_glob(value) end |
#to_pathname ⇒ Object
21 22 23 |
# File 'lib/fssm/path.rb', line 21 def to_pathname @path end |
#to_s ⇒ Object
17 18 19 |
# File 'lib/fssm/path.rb', line 17 def to_s @path.to_s end |
#update(*args, &block) ⇒ Object
34 35 36 |
# File 'lib/fssm/path.rb', line 34 def update(*args, &block) callback_action(:update, (block_given? ? block : args)) end |