Class: BetaBrite::Memory
- Inherits:
-
Object
- Object
- BetaBrite::Memory
- Defined in:
- lib/memory/memory.rb
Defined Under Namespace
Classes: Clear, Dots, String, Text
Constant Summary collapse
- COMMAND_CODE =
"E$"
- TEXT =
'A'
- STRING =
'B'
- DOTS =
'D'
- LOCKED =
'L'
- UNLOCKED =
'U'
Instance Attribute Summary collapse
-
#label ⇒ Object
Returns the value of attribute label.
-
#locked ⇒ Object
Returns the value of attribute locked.
-
#size ⇒ Object
Returns the value of attribute size.
-
#time ⇒ Object
Returns the value of attribute time.
-
#type ⇒ Object
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
- #format ⇒ Object (also: #to_s)
-
#initialize(opts = {}) {|_self| ... } ⇒ Memory
constructor
A new instance of Memory.
Constructor Details
#initialize(opts = {}) {|_self| ... } ⇒ Memory
Returns a new instance of Memory.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/memory/memory.rb', line 14 def initialize(opts = {}) args = { :label => 'A', :type => STRING, :locked => LOCKED, :size => sprintf("%04x", 0), :time => '0000' }.merge opts @label = args[:label] @type = args[:type] @locked = args[:locked] @size = args[:size] @time = args[:time] yield self if block_given? end |
Instance Attribute Details
#label ⇒ Object
Returns the value of attribute label.
13 14 15 |
# File 'lib/memory/memory.rb', line 13 def label @label end |
#locked ⇒ Object
Returns the value of attribute locked.
13 14 15 |
# File 'lib/memory/memory.rb', line 13 def locked @locked end |
#size ⇒ Object
Returns the value of attribute size.
13 14 15 |
# File 'lib/memory/memory.rb', line 13 def size @size end |
#time ⇒ Object
Returns the value of attribute time.
13 14 15 |
# File 'lib/memory/memory.rb', line 13 def time @time end |
#type ⇒ Object
Returns the value of attribute type.
13 14 15 |
# File 'lib/memory/memory.rb', line 13 def type @type end |
Class Method Details
.clear ⇒ Object
9 10 11 |
# File 'lib/memory/memory.rb', line 9 def self.clear BetaBrite::STX << COMMAND_CODE end |
Instance Method Details
#format ⇒ Object Also known as: to_s
29 30 31 32 |
# File 'lib/memory/memory.rb', line 29 def format #BetaBrite::STX << COMMAND_CODE << @label << @type << @locked << @label << @type << @locked << @size.upcase << @time end |