Class: FakeFS::FakeFile
- Inherits:
-
Object
- Object
- FakeFS::FakeFile
- Defined in:
- lib/fakefs/fake/file.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
-
#name ⇒ Object
Returns the value of attribute name.
-
#parent ⇒ Object
Returns the value of attribute parent.
Instance Method Summary collapse
- #clone(parent = nil) ⇒ Object
- #entry ⇒ Object
-
#initialize(name = nil, parent = nil) ⇒ FakeFile
constructor
A new instance of FakeFile.
- #inspect ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(name = nil, parent = nil) ⇒ FakeFile
5 6 7 8 9 |
# File 'lib/fakefs/fake/file.rb', line 5 def initialize(name = nil, parent = nil) @name = name @parent = parent @content = '' end |
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
3 4 5 |
# File 'lib/fakefs/fake/file.rb', line 3 def content @content end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/fakefs/fake/file.rb', line 3 def name @name end |
#parent ⇒ Object
Returns the value of attribute parent.
3 4 5 |
# File 'lib/fakefs/fake/file.rb', line 3 def parent @parent end |
Instance Method Details
#clone(parent = nil) ⇒ Object
11 12 13 14 15 |
# File 'lib/fakefs/fake/file.rb', line 11 def clone(parent = nil) clone = super() clone.parent = parent if parent clone end |
#entry ⇒ Object
17 18 19 |
# File 'lib/fakefs/fake/file.rb', line 17 def entry self end |
#inspect ⇒ Object
21 22 23 |
# File 'lib/fakefs/fake/file.rb', line 21 def inspect "(FakeFile name:#{name.inspect} parent:#{parent.to_s.inspect} size:#{content.size})" end |
#to_s ⇒ Object
25 26 27 |
# File 'lib/fakefs/fake/file.rb', line 25 def to_s File.join(parent.to_s, name) end |