Class: RhoDevelopment::RhofilelistItem

Inherits:
Object
  • Object
show all
Defined in:
lib/build/rhoDevelopment.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#datetimeObject

Returns the value of attribute datetime.



26
27
28
# File 'lib/build/rhoDevelopment.rb', line 26

def datetime
  @datetime
end

#fileObject

Returns the value of attribute file.



26
27
28
# File 'lib/build/rhoDevelopment.rb', line 26

def file
  @file
end

#hashObject

Returns the value of attribute hash.



26
27
28
# File 'lib/build/rhoDevelopment.rb', line 26

def hash
  @hash
end

#pathObject

Returns the value of attribute path.



26
27
28
# File 'lib/build/rhoDevelopment.rb', line 26

def path
  @path
end

#sizeObject

Returns the value of attribute size.



26
27
28
# File 'lib/build/rhoDevelopment.rb', line 26

def size
  @size
end

Class Method Details

.fromString(aString) ⇒ Object



28
29
30
31
32
# File 'lib/build/rhoDevelopment.rb', line 28

def self.fromString(aString)
  instance = self.new
  instance.initializeFromString(aString)
  instance
end

Instance Method Details

#==(object) ⇒ Object



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/build/rhoDevelopment.rb', line 57

def ==(object)
  if self.class != object.class
    return false
  end

  if self.path != object.path
    return false
  end

  if self.directory? and object.directory?
    return true
  end

  if self.file? and object.file?
    return self.hash == object.hash
  end

  return false

end

#allowedForDetectingChanges?Boolean

Returns:

  • (Boolean)


82
83
84
85
86
# File 'lib/build/rhoDevelopment.rb', line 82

def allowedForDetectingChanges?
  not_allowed = ['rhoconfig.txt', 'rhoconfig.txt.timestamp'].include?(self.path)
  puts "#{self.path} #{not_allowed}"
  return (!not_allowed)
end

#directory?Boolean

Returns:

  • (Boolean)


43
44
45
# File 'lib/build/rhoDevelopment.rb', line 43

def directory?
  (not self.file?)
end

#file?Boolean

Returns:

  • (Boolean)


47
48
49
# File 'lib/build/rhoDevelopment.rb', line 47

def file?
  @file
end

#fixed_pathObject



51
52
53
54
55
# File 'lib/build/rhoDevelopment.rb', line 51

def fixed_path
  fixed_path = @path.gsub('_erb.iseq', '.erb')
  fixed_path = fixed_path.gsub('.iseq', '.rb')
  return fixed_path
end

#initializeFromString(aString) ⇒ Object



34
35
36
37
38
39
40
41
# File 'lib/build/rhoDevelopment.rb', line 34

def initializeFromString(aString)
  elements = aString.split('|')
  @path = elements[0]
  @file = elements[1] == 'file'
  @size = elements[2].to_i
  @datetime = elements[3].to_i
  @hash = @file ? elements[4] : ''
end

#inspectObject



78
79
80
# File 'lib/build/rhoDevelopment.rb', line 78

def inspect
  "#{@path}|#{self.file? ? 'file' : 'dir'}|#{self.size}|#{self.datetime}|#{self.file? ? self.hash : ''}"
end