Class: RubyText::Effects
- Inherits:
-
Object
- Object
- RubyText::Effects
- Defined in:
- lib/effects.rb
Overview
dumb name?
Constant Summary collapse
- Modes =
%w[A_BOLD A_NORMAL A_PROTECT A_REVERSE A_STANDOUT A_UNDERLINE]
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(bg, *args) ⇒ Effects
constructor
A new instance of Effects.
Constructor Details
#initialize(bg, *args) ⇒ Effects
Returns a new instance of Effects.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/effects.rb', line 6 def initialize(bg, *args) bits = 0 args.each do |arg| if Modes.include?(arg) val = eval("X::A_#{arg.to_s.upcase}") bits ||= val elsif RubyText::Colors.include?(arg) val = eval("X::COLOR_#{arg.to_s.upcase}") bits ||= val end end @value = bits X.attrset(bits) end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
4 5 6 |
# File 'lib/effects.rb', line 4 def value @value end |