Class: DOSFile
Overview
Apple DOS 3.3 file
Direct Known Subclasses
AppleSoftFile, BinaryFile, IntegerBasicFile, SCAsmFile, TextFile
Constant Summary
Constants inherited from DSKFile
Instance Attribute Summary collapse
-
#contents ⇒ Object
Returns the value of attribute contents.
-
#file_type_byte ⇒ Object
Returns the value of attribute file_type_byte.
-
#filename ⇒ Object
Returns the value of attribute filename.
-
#locked ⇒ Object
Returns the value of attribute locked.
Class Method Summary collapse
-
.catalog_filename(filename) ⇒ Object
render a filename in form suitable for inclusion in a DOS catalog.
Instance Method Summary collapse
- #catalog_filename ⇒ Object
-
#file_type ⇒ Object
File type as displayed in Apple DOS 3.3 Catalog.
-
#initialize(filename, contents, locked = false, file_type_byte = nil) ⇒ DOSFile
constructor
A new instance of DOSFile.
Methods inherited from DSKFile
#==, #buffer_as_applesoft_file, #can_be_picture?, #file_extension, #hex_dump, #length_in_sectors, #to_ascii, #to_s
Constructor Details
#initialize(filename, contents, locked = false, file_type_byte = nil) ⇒ DOSFile
Returns a new instance of DOSFile.
12 13 14 15 16 17 18 |
# File 'lib/DOSFile.rb', line 12 def initialize(filename,contents,locked=false,file_type_byte=nil) @filename=filename @locked=locked @contents=contents @file_type_byte=file_type_byte @file_type=sprintf("$%02X",file_type_byte) end |
Instance Attribute Details
#contents ⇒ Object
Returns the value of attribute contents.
11 12 13 |
# File 'lib/DOSFile.rb', line 11 def contents @contents end |
#file_type_byte ⇒ Object
Returns the value of attribute file_type_byte.
11 12 13 |
# File 'lib/DOSFile.rb', line 11 def file_type_byte @file_type_byte end |
#filename ⇒ Object
Returns the value of attribute filename.
11 12 13 |
# File 'lib/DOSFile.rb', line 11 def filename @filename end |
#locked ⇒ Object
Returns the value of attribute locked.
11 12 13 |
# File 'lib/DOSFile.rb', line 11 def locked @locked end |
Class Method Details
.catalog_filename(filename) ⇒ Object
render a filename in form suitable for inclusion in a DOS catalog
30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/DOSFile.rb', line 30 def DOSFile.catalog_filename(filename) s="" for i in 0..29 c=(filename[i]) if c.nil? then c=0xA0 else c=(c|0x80) end s+=c.chr end s end |
Instance Method Details
#catalog_filename ⇒ Object
44 45 46 |
# File 'lib/DOSFile.rb', line 44 def catalog_filename DOSFile.catalog_filename(filename) end |
#file_type ⇒ Object
File type as displayed in Apple DOS 3.3 Catalog
22 23 24 |
# File 'lib/DOSFile.rb', line 22 def file_type @file_type end |