Class: BetaBrite::TextFile
- Inherits:
-
Object
- Object
- BetaBrite::TextFile
- Defined in:
- lib/files/textfile.rb
Defined Under Namespace
Constant Summary collapse
- WRITE =
0x41.chr
- READ =
0x42.chr
Instance Attribute Summary collapse
-
#display_position ⇒ Object
Returns the value of attribute display_position.
-
#label ⇒ Object
Returns the value of attribute label.
-
#message ⇒ Object
Returns the value of attribute message.
-
#mode ⇒ Object
Returns the value of attribute mode.
Instance Method Summary collapse
- #checksum(string) ⇒ Object
-
#initialize {|_self| ... } ⇒ TextFile
constructor
A new instance of TextFile.
- #to_s ⇒ Object (also: #inspect)
Constructor Details
Instance Attribute Details
#display_position ⇒ Object
Returns the value of attribute display_position.
63 64 65 |
# File 'lib/files/textfile.rb', line 63 def display_position @display_position end |
#label ⇒ Object
Returns the value of attribute label.
63 64 65 |
# File 'lib/files/textfile.rb', line 63 def label @label end |
#message ⇒ Object
Returns the value of attribute message.
63 64 65 |
# File 'lib/files/textfile.rb', line 63 def @message end |
#mode ⇒ Object
Returns the value of attribute mode.
63 64 65 |
# File 'lib/files/textfile.rb', line 63 def mode @mode end |
Instance Method Details
#checksum(string) ⇒ Object
76 77 78 79 80 81 82 83 |
# File 'lib/files/textfile.rb', line 76 def checksum(string) total = 0 0.upto(string.length - 1) do |i| total += string[i] end sprintf("%04x", total).upcase end |
#to_s ⇒ Object Also known as: inspect
72 73 74 |
# File 'lib/files/textfile.rb', line 72 def to_s "#{combine}#{checksum(combine)}" end |