Class: FilePathAndPermissions

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/gpm/file_path_and_permissions.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path, permissions = 0444) ⇒ FilePathAndPermissions

Returns a new instance of FilePathAndPermissions.



4
5
6
7
8
# File 'lib/gpm/file_path_and_permissions.rb', line 4

def initialize(path, permissions = 0444)
  @path = path.to_s
  super(@path)
  @permissions = permissions
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



3
4
5
# File 'lib/gpm/file_path_and_permissions.rb', line 3

def path
  @path
end

#permissionsObject (readonly)

Returns the value of attribute permissions.



3
4
5
# File 'lib/gpm/file_path_and_permissions.rb', line 3

def permissions
  @permissions
end

Instance Method Details

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
13
14
# File 'lib/gpm/file_path_and_permissions.rb', line 10

def eql?(other)
  return @path == other if other.is_a? String
  return @path == other.path if other.is_a? FilePathAndPermissions
  super
end

#hashObject



21
22
23
# File 'lib/gpm/file_path_and_permissions.rb', line 21

def hash
  @path.hash
end

#inspectObject



16
17
18
19
# File 'lib/gpm/file_path_and_permissions.rb', line 16

def inspect
  vars = instance_variables.collect { |v| v.to_s << "=#{instance_variable_get(v).inspect}"}.join(", ")
  "#<#{self.class}:#{vars}>"
end