Class: BetaBrite::DotsFile

Inherits:
Object
  • Object
show all
Defined in:
lib/files/dotsfile.rb

Constant Summary collapse

COMMAND_CODE =
0x49.chr

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(label, rows, columns, picture) ⇒ DotsFile

Returns a new instance of DotsFile.



7
8
9
10
11
12
# File 'lib/files/dotsfile.rb', line 7

def initialize(label, rows, columns, picture)
  @label    = label
  @rows     = rows
  @columns  = columns
  @picture  = picture
end

Instance Attribute Details

#columnsObject

Returns the value of attribute columns.



5
6
7
# File 'lib/files/dotsfile.rb', line 5

def columns
  @columns
end

#labelObject

Returns the value of attribute label.



5
6
7
# File 'lib/files/dotsfile.rb', line 5

def label
  @label
end

#pictureObject

Returns the value of attribute picture.



5
6
7
# File 'lib/files/dotsfile.rb', line 5

def picture
  @picture
end

#rowsObject

Returns the value of attribute rows.



5
6
7
# File 'lib/files/dotsfile.rb', line 5

def rows
  @rows
end

Instance Method Details

#idObject



14
15
16
# File 'lib/files/dotsfile.rb', line 14

def id
  BetaBrite::STRING << @label
end

#to_sObject



18
19
20
21
22
# File 'lib/files/dotsfile.rb', line 18

def to_s
  string = "#{BetaBrite::STX}#{COMMAND_CODE}#{@label.to_s}" +
    "#{sprintf('%02x', @rows)}#{sprintf('%02x', @columns)}" +
    "#{picture.join(BetaBrite::CR)}#{BetaBrite::CR}"
end