Class: PathMapper::DirNode

Inherits:
Object
  • Object
show all
Includes:
BaseNode
Defined in:
lib/path_mapper.rb

Instance Attribute Summary

Attributes included from BaseNode

#_name, #_path

Instance Method Summary collapse

Methods included from BaseNode

#_grep, #_grep_dirs, #_grep_files, #get_file_name, #initialize, #inspect, #to_s

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *args, **kwargs, &block) ⇒ Object



56
57
58
# File 'lib/path_mapper.rb', line 56

def method_missing(m, *args, **kwargs, &block)
  self.f(m, **kwargs)
end

Instance Method Details

#f(m, **kwargs) ⇒ Object



60
61
62
63
# File 'lib/path_mapper.rb', line 60

def f(m, **kwargs)
  obj = PathMapper.new(File.join(@_path, m.to_s))
  (obj.empty? and kwargs.key? :default) ? kwargs[:default] : obj
end