Module: CSD::Extensions::Core::Object

Included in:
Object
Defined in:
lib/csd/extensions/core/object.rb

Overview

This module comprises extensions to Object (the parent of all classes).

Instance Method Summary collapse

Instance Method Details

#pathnamifyObject

Creates a Pathname object from the current object.

Examples

'/my/path'.pathnamify            # =>  #<Pathname:my/path>
my_pathname_object.pathnamify    # =>  #<Pathname:my/path>


18
19
20
21
22
23
24
# File 'lib/csd/extensions/core/object.rb', line 18

def pathnamify
  case self
    when ::Pathname then self
    when NilClass then raise ::CSD::Error::Internal::PathnamifyingNil
    else ::Pathname.new(self)
  end
end