Class: BetaBrite::Files::String

Inherits:
Object
  • Object
show all
Includes:
BetaBrite::FileDSL
Defined in:
lib/betabrite/files/string.rb

Constant Summary collapse

COMMAND_CODE =
'G'

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from BetaBrite::FileDSL

#print, #string

Constructor Details

#initialize(label = nil, message = nil, &block) ⇒ String

Returns a new instance of String.



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

def initialize(label = nil, message = nil, &block)
  @label    = label
  @message  = message
  instance_eval(&block) if block
end

Instance Attribute Details

#labelObject

Returns the value of attribute label.



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

def label
  @label
end

#messageObject

Returns the value of attribute message.



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

def message
  @message
end

Instance Method Details

#to_sObject Also known as: to_str



15
16
17
18
# File 'lib/betabrite/files/string.rb', line 15

def to_s
  "#{BetaBrite::Base::STX}#{COMMAND_CODE}#{@label.to_s}" +
    "#{@message.to_s}#{BetaBrite::Base::ETX}"
end