Class: RubyText::Effects

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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

#valueObject (readonly)

Returns the value of attribute value.



4
5
6
# File 'lib/effects.rb', line 4

def value
  @value
end