Class: Path

Inherits:
Pathname show all
Defined in:
lib/rake-plus/path.rb

Overview

Like a Pathname but behaves more like a string

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Pathname

#+, #join, #relative_path_from

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *a, &b) ⇒ Object



68
69
70
71
72
73
74
75
# File 'lib/rake-plus/path.rb', line 68

def method_missing(m, *a, &b)
  s = to_s
  if s.respond_to? m
    s.send(m, *a, &b)
  else
    super
  end
end

Class Method Details

.[](*args) ⇒ Object



83
84
85
# File 'lib/rake-plus/path.rb', line 83

def self.[](*args)
  new File.join(*args.map(&:to_s))
end

Instance Method Details

#<=>(other) ⇒ Object



64
# File 'lib/rake-plus/path.rb', line 64

def <=>(other); to_s <=> other.to_s end

#=~(regex) ⇒ Object



63
# File 'lib/rake-plus/path.rb', line 63

def =~(regex); to_s =~ regex end

#lengthObject Also known as: size



65
# File 'lib/rake-plus/path.rb', line 65

def length; to_s.length end

#respond_to?(m) ⇒ Boolean

Returns:

  • (Boolean)


77
78
79
# File 'lib/rake-plus/path.rb', line 77

def respond_to?(m)
  super || to_s.respond_to?(m)
end