module GodObject::FilePermissions::HelperMixin

Mixin containing helper methods

@private

Constants

STRING_FORMAT

@return [Array<Symbol>] possible output String formats

Protected Instance Methods

to_pathname(path, nil_handling = :forbid_nil) click to toggle source

Ensures that input is Pathname

@param [Pathname, String] path a path @param [:forbid_nil, :allow_nil] nil_handling if set to :allow_nil,

a nil path will be passed-through. Raises an exception otherwise

@return [Pathname] the path as Pathname object

# File lib/god_object/file_permissions/helper_mixin.rb, line 39
def to_pathname(path, nil_handling = :forbid_nil)
  return nil if path.nil? if nil_handling == :allow_nil

  path.is_a?(Pathname) ? path : Pathname.new(path)
end