Class: MacTypes::Alias

Inherits:
FileBase show all
Defined in:
lib/_aem/mactypes.rb

Overview

public

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from FileBase

#==, _coerce, #hash

Constructor Details

#initialize(desc) ⇒ Alias

Returns a new instance of Alias.



57
58
59
# File 'lib/_aem/mactypes.rb', line 57

def initialize(desc)
  @desc = desc
end

Instance Attribute Details

#descObject (readonly)

Methods



89
90
91
# File 'lib/_aem/mactypes.rb', line 89

def desc
  @desc
end

Class Method Details

.desc(desc) ⇒ Object



82
83
84
85
# File 'lib/_aem/mactypes.rb', line 82

def Alias.desc(desc)
  # Make Alias object from CarbonX.AE.AEDesc of typeAlias. Note: descriptor type is not checked; clients are responsible for passing the correct type as other types will cause unexpected problems/errors.
  return new(desc)
end

.hfs_path(path) ⇒ Object



70
71
72
73
74
75
# File 'lib/_aem/mactypes.rb', line 70

def Alias.hfs_path(path)
  # Make Alias object from HFS path.
  return new(FileBase._coerce(
                              AE::AEDesc.new(KAE::TypeFileURL, AE.convert_path_to_url(path, KCFURLHFSPathStyle)),
                              KAE::TypeAlias, path))
end

.path(path) ⇒ Object

Constructors



63
64
65
66
67
68
# File 'lib/_aem/mactypes.rb', line 63

def Alias.path(path)
  # Make Alias object from POSIX path.
  return new(FileBase._coerce(
                              AE::AEDesc.new(KAE::TypeFileURL, AE.convert_path_to_url(path, KCFURLPOSIXPathStyle)),
                              KAE::TypeAlias, path))
end

.url(url) ⇒ Object



77
78
79
80
# File 'lib/_aem/mactypes.rb', line 77

def Alias.url(url)
  # Make Alias object from file URL. Note: only the path portion of the URL is used; the domain will always be localhost.
  return Alias.path(AE.convert_url_to_path(url, KCFURLPOSIXPathStyle))
end

Instance Method Details

#hfs_pathObject



101
102
103
104
# File 'lib/_aem/mactypes.rb', line 101

def hfs_path
  # Get as HFS path.
  return AE.convert_url_to_path(FileBase._coerce(@desc, KAE::TypeFileURL).data, KCFURLHFSPathStyle)
end

#inspectObject



108
109
110
# File 'lib/_aem/mactypes.rb', line 108

def inspect
  return "MacTypes::Alias.path(#{to_s.inspect})"
end

#pathObject Also known as: to_s



96
97
98
99
# File 'lib/_aem/mactypes.rb', line 96

def path
  # Get as POSIX path.
  return AE.convert_url_to_path(FileBase._coerce(@desc, KAE::TypeFileURL).data, KCFURLPOSIXPathStyle)
end

#to_aliasObject



112
113
114
115
# File 'lib/_aem/mactypes.rb', line 112

def to_alias
  # Get as MacTypes::Alias.
  return self
end

#to_file_urlObject



117
118
119
120
# File 'lib/_aem/mactypes.rb', line 117

def to_file_url
  # Get as MacTypes::FileURL; note that the resulting FileURL object will always pack as an AEDesc of typeFileURL.
  return MacTypes::FileURL.desc(FileBase._coerce(@desc, KAE::TypeFileURL))
end

#urlObject



91
92
93
94
# File 'lib/_aem/mactypes.rb', line 91

def url
  # Get as URL string.
  return desc.coerce(KAE::TypeFileURL).data
end