Class: MacTypes::FileBase

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

Direct Known Subclasses

Alias, FileURL

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

._coerce(desc, type, path = nil) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/_aem/mactypes.rb', line 21

def FileBase._coerce(desc, type, path=nil)
  begin
    return desc.coerce(type)
  rescue AE::MacOSError => e
    if [-35, -43, -120, -1700].include?(e.to_i) # disk/file/folder not found, or coercion error
      if path != nil
        raise FileNotFoundError, "File #{path.inspect} not found."
      else
        raise FileNotFoundError, "File not found."
      end
    else
      raise
    end
  end
end

Instance Method Details

#==(val) ⇒ Object Also known as: eql?



37
38
39
# File 'lib/_aem/mactypes.rb', line 37

def ==(val)
  return (self.equal?(val) or (self.class == val.class and self.url == val.url))
end

#hashObject



43
44
45
# File 'lib/_aem/mactypes.rb', line 43

def hash
  return [desc.type, desc.data].hash
end