Class: BetaBrite::String
- Inherits:
-
Object
- Object
- BetaBrite::String
- Defined in:
- lib/string.rb
Overview
This class encapsulates a string and attributes about the string such as color, character set, and also contains special characters.
Defined Under Namespace
Constant Summary collapse
- LEFT_ARROW =
0xc6.chr
- RIGHT_ARROW =
0xc6.chr
- PACKMAN =
0xc8.chr
- SAIL_BOAT =
0xc9.chr
- BALL =
0xca.chr
- TELEPHONE =
0xcb.chr
- HEART =
0xcc.chr
- CAR =
0xcd.chr
- HANDICAP =
0xce.chr
- RHINO =
0xcf.chr
- MUG =
0xd0.chr
- SATELLITE_DISH =
0xd1.chr
- COPYRIGHT =
0xd2.chr
- MALE_SYM =
0xd3.chr
- FEMALE_SYM =
0xd4.chr
- BOTTLE =
0xd5.chr
- DISKETTE =
0xd6.chr
- PRINTER =
0xd7.chr
- NOTE =
0xd8.chr
- INFINITY =
0xd9.chr
Instance Attribute Summary collapse
-
#charset ⇒ Object
Returns the value of attribute charset.
-
#color ⇒ Object
Returns the value of attribute color.
-
#string ⇒ Object
Returns the value of attribute string.
Instance Method Summary collapse
-
#initialize(string, opts = {}) ⇒ String
constructor
A new instance of String.
- #to_s ⇒ Object
Constructor Details
#initialize(string, opts = {}) ⇒ String
Returns a new instance of String.
57 58 59 60 61 62 63 64 |
# File 'lib/string.rb', line 57 def initialize(string, opts = {}) args = { :color => Color::GREEN, :charset => CharSet::SEVEN_HIGH }.merge opts @string = string @color = args[:color] @charset = args[:charset] end |
Instance Attribute Details
#charset ⇒ Object
Returns the value of attribute charset.
55 56 57 |
# File 'lib/string.rb', line 55 def charset @charset end |
#color ⇒ Object
Returns the value of attribute color.
55 56 57 |
# File 'lib/string.rb', line 55 def color @color end |
#string ⇒ Object
Returns the value of attribute string.
55 56 57 |
# File 'lib/string.rb', line 55 def string @string end |
Instance Method Details
#to_s ⇒ Object
66 67 68 |
# File 'lib/string.rb', line 66 def to_s "#{0x1a.chr}#{@charset}#{0x1c.chr}#{@color}#{@string}" end |