Class: BuildMaster::FileContent

Inherits:
Object
  • Object
show all
Defined in:
lib/buildmaster/cotta/in_memory_system.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ FileContent

Returns a new instance of FileContent.



215
216
217
218
# File 'lib/buildmaster/cotta/in_memory_system.rb', line 215

def initialize(name)
  @name = name
  @content = ''
end

Instance Attribute Details

#contentObject

Returns the value of attribute content.



212
213
214
# File 'lib/buildmaster/cotta/in_memory_system.rb', line 212

def content
  @content
end

#nameObject (readonly)

Returns the value of attribute name.



212
213
214
# File 'lib/buildmaster/cotta/in_memory_system.rb', line 212

def name
  @name
end

Instance Method Details

#copy_to_dir(system, parent_dir, target_dir) ⇒ Object



232
233
234
235
236
# File 'lib/buildmaster/cotta/in_memory_system.rb', line 232

def copy_to_dir(system, parent_dir, target_dir)
  target_path = target_dir.join(name)
  source_path = parent_dir.join(name)
  system.copy_file(source_path, target_path)
end

#directory?Boolean

Returns:

  • (Boolean)


224
225
226
# File 'lib/buildmaster/cotta/in_memory_system.rb', line 224

def directory?
  return false
end

#file?Boolean

Returns:

  • (Boolean)


220
221
222
# File 'lib/buildmaster/cotta/in_memory_system.rb', line 220

def file?
  return true
end

#sizeObject



228
229
230
# File 'lib/buildmaster/cotta/in_memory_system.rb', line 228

def size
  content.size
end