Class: BetaBrite::Files::Dots

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

Constant Summary collapse

COMMAND_CODE =
0x49.chr

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(label, rows, columns, picture, &block) ⇒ Dots

Returns a new instance of Dots.



8
9
10
11
12
13
14
# File 'lib/betabrite/files/dots.rb', line 8

def initialize(label, rows, columns, picture, &block)
  @label    = label
  @rows     = rows
  @columns  = columns
  @picture  = picture
  instance_eval(&block) if block
end

Instance Attribute Details

#columnsObject

Returns the value of attribute columns.



6
7
8
# File 'lib/betabrite/files/dots.rb', line 6

def columns
  @columns
end

#labelObject

Returns the value of attribute label.



6
7
8
# File 'lib/betabrite/files/dots.rb', line 6

def label
  @label
end

#pictureObject

Returns the value of attribute picture.



6
7
8
# File 'lib/betabrite/files/dots.rb', line 6

def picture
  @picture
end

#rowsObject

Returns the value of attribute rows.



6
7
8
# File 'lib/betabrite/files/dots.rb', line 6

def rows
  @rows
end

Instance Method Details

#to_sObject Also known as: to_str



16
17
18
19
20
# File 'lib/betabrite/files/dots.rb', line 16

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