Class: Cotta::ContentStat

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(content) ⇒ ContentStat

Returns a new instance of ContentStat.



262
263
264
265
# File 'lib/cotta/impl/in_memory_system.rb', line 262

def initialize(content)
  @content = content
  @mtime = Time.new
end

Instance Attribute Details

#mtimeObject (readonly)

Returns the value of attribute mtime.



260
261
262
# File 'lib/cotta/impl/in_memory_system.rb', line 260

def mtime
  @mtime
end

Instance Method Details

#<=>(stat) ⇒ Object



291
292
293
# File 'lib/cotta/impl/in_memory_system.rb', line 291

def <=> stat
  mtime <=> stat.mtime
end

#directory?Boolean

Returns:

  • (Boolean)


279
280
281
# File 'lib/cotta/impl/in_memory_system.rb', line 279

def directory?
    @content.directory?
end

#file?Boolean

Returns:

  • (Boolean)


275
276
277
# File 'lib/cotta/impl/in_memory_system.rb', line 275

def file?
  @content.file?
end

#modeObject



267
268
269
# File 'lib/cotta/impl/in_memory_system.rb', line 267

def mode
  '10777'
end

#sizeObject



271
272
273
# File 'lib/cotta/impl/in_memory_system.rb', line 271

def size
  @content.size
end

#touchObject



283
284
285
# File 'lib/cotta/impl/in_memory_system.rb', line 283

def touch
  @mtime = Time.new
end

#writable?Boolean

Returns:

  • (Boolean)


287
288
289
# File 'lib/cotta/impl/in_memory_system.rb', line 287

def writable?
  true
end