Class: IcePatch2::FileInfo

Inherits:
Object
  • Object
show all
Includes:
Ice::Inspect_mixin
Defined in:
lib/IcePatch2/FileInfo.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Ice::Inspect_mixin

#inspect

Constructor Details

#initialize(path = '', checksum = nil, size = 0, executable = false) ⇒ FileInfo

Returns a new instance of FileInfo.



25
26
27
28
29
30
# File 'lib/IcePatch2/FileInfo.rb', line 25

def initialize(path='', checksum=nil, size=0, executable=false)
    @path = path
    @checksum = checksum
    @size = size
    @executable = executable
end

Instance Attribute Details

#checksumObject

Returns the value of attribute checksum.



54
55
56
# File 'lib/IcePatch2/FileInfo.rb', line 54

def checksum
  @checksum
end

#executableObject

Returns the value of attribute executable.



54
55
56
# File 'lib/IcePatch2/FileInfo.rb', line 54

def executable
  @executable
end

#pathObject

Returns the value of attribute path.



54
55
56
# File 'lib/IcePatch2/FileInfo.rb', line 54

def path
  @path
end

#sizeObject

Returns the value of attribute size.



54
55
56
# File 'lib/IcePatch2/FileInfo.rb', line 54

def size
  @size
end

Instance Method Details

#==(other) ⇒ Object



41
42
43
44
45
46
47
48
# File 'lib/IcePatch2/FileInfo.rb', line 41

def ==(other)
    return false if !other.is_a? ::IcePatch2::FileInfo or
        @path != other.path or
        @checksum != other.checksum or
        @size != other.size or
        @executable != other.executable
    true
end

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


50
51
52
# File 'lib/IcePatch2/FileInfo.rb', line 50

def eql?(other)
    return other.class == self.class && other == self
end

#hashObject



32
33
34
35
36
37
38
39
# File 'lib/IcePatch2/FileInfo.rb', line 32

def hash
    _h = 0
    _h = 5 * _h + @path.hash
    _h = 5 * _h + @checksum.hash
    _h = 5 * _h + @size.hash
    _h = 5 * _h + @executable.hash
    _h % 0x7fffffff
end