module PathMapper::Node::Dir

Public Instance Methods

f(m, **kwargs) click to toggle source
Calls superclass method
# File lib/path_mapper/node/dir.rb, line 15
def f(m, **kwargs)
  def with_file_node(fname, **kwargs)
    if (obj = self._create_node(@path.join(fname))).file?
      yield obj
    end
  end

  res = case m.to_s
    when /(.*)(?=\?)/ then with_file_node($1) {|node| node.bool } || false
    when /(.*)(?=_val)/ then with_file_node($1) {|node| node.value }
    when /(.*)(?=_lines)/ then with_file_node($1) {|node| node.lines }
  end
  res.nil? ? super : res
end
method_missing(m, *args, &block) click to toggle source
Calls superclass method
# File lib/path_mapper/node/dir.rb, line 10
def method_missing(m, *args, &block)
  resp = self.f(m, self.kwargs(args)) if (resp = super).is_a? NilClass # Base::File
  resp
end
with_file_node(fname, **kwargs) { |obj| ... } click to toggle source
# File lib/path_mapper/node/dir.rb, line 16
def with_file_node(fname, **kwargs)
  if (obj = self._create_node(@path.join(fname))).file?
    yield obj
  end
end