Class: PathMapper::NullNode

Inherits:
BasicObject
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_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



85
86
87
88
89
90
91
# File 'lib/path_mapper.rb', line 85

def method_missing(m, *args, **kwargs, &block)
  if nil.respond_to? m
    nil.send m, *args, &block
  else
    self.f(m, **kwargs)
  end
end

Instance Method Details

#_grep(reg, recursive = false) ⇒ Object



97
98
99
# File 'lib/path_mapper.rb', line 97

def _grep(reg, recursive=false)
  []
end

#any?Boolean

Returns:

  • (Boolean)


109
110
111
# File 'lib/path_mapper.rb', line 109

def any?
  false
end

#emptyObject



105
106
107
# File 'lib/path_mapper.rb', line 105

def empty
  true
end

#f(m, **kwargs) ⇒ Object



93
94
95
# File 'lib/path_mapper.rb', line 93

def f(m, **kwargs)
  kwargs.key?(:default) ? kwargs[:default] : NullNode.new([@_path, m.to_s].join(::File::SEPARATOR))
end

#nil?Boolean

Returns:

  • (Boolean)


101
102
103
# File 'lib/path_mapper.rb', line 101

def nil?
  true
end