Class: TextStyle

Inherits:
Style show all
Defined in:
lib/yesroff/text.rb

Instance Attribute Summary collapse

Attributes inherited from Style

#name, #parent

Instance Method Summary collapse

Methods inherited from Style

#base_style, #child_of?, #initialize

Constructor Details

This class inherits a constructor from Style

Instance Attribute Details

#boldObject

Returns the value of attribute bold.



24
25
26
# File 'lib/yesroff/text.rb', line 24

def bold
  @bold
end

#codeObject

Returns the value of attribute code.



24
25
26
# File 'lib/yesroff/text.rb', line 24

def code
  @code
end

#italicObject

Returns the value of attribute italic.



24
25
26
# File 'lib/yesroff/text.rb', line 24

def italic
  @italic
end

Instance Method Details

#render(w) ⇒ Object



34
35
36
37
38
# File 'lib/yesroff/text.rb', line 34

def render(w)
  w.toggle_bold if @bold
  w.toggle_code if @code
  w.toggle_italic if @italic
end

#to_sObject



26
27
28
29
30
31
32
# File 'lib/yesroff/text.rb', line 26

def to_s
  result = "[Style: #{name}"
  result += 'B' if @bold
  result += 'I' if @italic
  result += 'C' if @code
  result += ']'
end