Class: FFFS::File
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
-
#filesystem ⇒ Object
Returns the value of attribute filesystem.
-
#name ⇒ Object
Returns the value of attribute name.
-
#parent ⇒ Object
Returns the value of attribute parent.
Instance Method Summary collapse
-
#initialize(name, content = '', parent = nil, filesystem = nil) ⇒ File
constructor
A new instance of File.
- #inspect ⇒ Object
- #save(path) ⇒ Object
- #to_s ⇒ Object
Methods included from Node
Constructor Details
#initialize(name, content = '', parent = nil, filesystem = nil) ⇒ File
32 33 34 35 36 37 38 39 40 |
# File 'lib/fffs/file.rb', line 32 def initialize (name, content='', parent=nil, filesystem=nil) @filesystem = filesystem @parent = parent @name = name @content = content.clone @content.force_encoding 'ASCII-8BIT' end |
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
29 30 31 |
# File 'lib/fffs/file.rb', line 29 def content @content end |
#filesystem ⇒ Object
Returns the value of attribute filesystem.
27 28 29 |
# File 'lib/fffs/file.rb', line 27 def filesystem @filesystem end |
#name ⇒ Object
Returns the value of attribute name.
30 31 32 |
# File 'lib/fffs/file.rb', line 30 def name @name end |
#parent ⇒ Object
Returns the value of attribute parent.
27 28 29 |
# File 'lib/fffs/file.rb', line 27 def parent @parent end |
Instance Method Details
#inspect ⇒ Object
58 59 60 |
# File 'lib/fffs/file.rb', line 58 def inspect self.path end |
#save(path) ⇒ Object
48 49 50 51 52 |
# File 'lib/fffs/file.rb', line 48 def save (path) ::File.open(path, 'wb') {|f| f.write content } end |
#to_s ⇒ Object
54 55 56 |
# File 'lib/fffs/file.rb', line 54 def to_s @content end |