Class: BetaBrite::StringFile

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

Constant Summary collapse

COMMAND_CODE =
'G'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(label = nil, message = nil) {|_self| ... } ⇒ StringFile

Returns a new instance of StringFile.

Yields:

  • (_self)

Yield Parameters:



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

def initialize(label = nil, message = nil)
  @label    = label
  @message  = message
  yield self if block_given?
end

Instance Attribute Details

#labelObject

Returns the value of attribute label.



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

def label
  @label
end

#messageObject

Returns the value of attribute message.



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

def message
  @message
end

Instance Method Details

#idObject



13
14
15
# File 'lib/files/stringfile.rb', line 13

def id
  "#{BetaBrite::DLE}#{@label}"
end

#to_sObject



17
18
19
20
# File 'lib/files/stringfile.rb', line 17

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