Class: Cotta::FileContent
- Inherits:
-
Object
- Object
- Cotta::FileContent
- Defined in:
- lib/cotta/impl/in_memory_system.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#stat ⇒ Object
readonly
Returns the value of attribute stat.
Instance Method Summary collapse
- #copy_to_dir(system, parent_dir, target_dir) ⇒ Object
- #directory? ⇒ Boolean
- #file? ⇒ Boolean
-
#initialize(name) ⇒ FileContent
constructor
A new instance of FileContent.
- #size ⇒ Object
- #touch ⇒ Object
Constructor Details
#initialize(name) ⇒ FileContent
Returns a new instance of FileContent.
230 231 232 233 234 |
# File 'lib/cotta/impl/in_memory_system.rb', line 230 def initialize(name) @name = name @content = '' @stat = ContentStat.new(self) end |
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
227 228 229 |
# File 'lib/cotta/impl/in_memory_system.rb', line 227 def content @content end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
227 228 229 |
# File 'lib/cotta/impl/in_memory_system.rb', line 227 def name @name end |
#stat ⇒ Object (readonly)
Returns the value of attribute stat.
227 228 229 |
# File 'lib/cotta/impl/in_memory_system.rb', line 227 def stat @stat end |
Instance Method Details
#copy_to_dir(system, parent_dir, target_dir) ⇒ Object
248 249 250 251 252 |
# File 'lib/cotta/impl/in_memory_system.rb', line 248 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
240 241 242 |
# File 'lib/cotta/impl/in_memory_system.rb', line 240 def directory? return false end |
#file? ⇒ Boolean
236 237 238 |
# File 'lib/cotta/impl/in_memory_system.rb', line 236 def file? return true end |
#size ⇒ Object
244 245 246 |
# File 'lib/cotta/impl/in_memory_system.rb', line 244 def size content.size end |
#touch ⇒ Object
254 255 256 |
# File 'lib/cotta/impl/in_memory_system.rb', line 254 def touch @stat.touch end |