Module: RichText::Styleable
- Included in:
- Document::Entry
- Defined in:
- lib/richtext/styleable.rb
Instance Method Summary collapse
-
#bold=(b) ⇒ Object
Sets bold to either true or false, depending on the given argument.
-
#bold? ⇒ Boolean
Returns true if bold formatting is applied.
-
#color ⇒ Object
Returns the color value if it is set, otherwise nil.
-
#color=(c) ⇒ Object
Sets the color value.
-
#font ⇒ Object
Returns the font value if it is set, otherwise nil.
-
#font=(f) ⇒ Object
Sets the font value.
-
#italic=(i) ⇒ Object
Sets italic to either true or false, depending on the given argument.
-
#italic? ⇒ Boolean
Returns true if italic formatting is applied.
-
#underlined=(u) ⇒ Object
(also: #underline=)
Sets underlined to either true or false, depending on the given argument.
-
#underlined? ⇒ Boolean
(also: #underline?)
Returns true if underlined formatting is applied.
Instance Method Details
#bold=(b) ⇒ Object
Sets bold to either true or false, depending on the given argument.
12 13 14 |
# File 'lib/richtext/styleable.rb', line 12 def bold=(b) self[:bold] = b ? true : false end |
#bold? ⇒ Boolean
Returns true if bold formatting is applied.
6 7 8 |
# File 'lib/richtext/styleable.rb', line 6 def bold? self[:bold] end |
#color ⇒ Object
Returns the color value if it is set, otherwise nil.
46 47 48 |
# File 'lib/richtext/styleable.rb', line 46 def color self[:color] end |
#color=(c) ⇒ Object
Sets the color value.
52 53 54 |
# File 'lib/richtext/styleable.rb', line 52 def color=(c) self[:color] = c end |
#font ⇒ Object
Returns the font value if it is set, otherwise nil.
58 59 60 |
# File 'lib/richtext/styleable.rb', line 58 def font self[:font] end |
#font=(f) ⇒ Object
Sets the font value.
64 65 66 |
# File 'lib/richtext/styleable.rb', line 64 def font=(f) self[:font] = f end |
#italic=(i) ⇒ Object
Sets italic to either true or false, depending on the given argument.
24 25 26 |
# File 'lib/richtext/styleable.rb', line 24 def italic=(i) self[:italic] = i ? true : false end |
#italic? ⇒ Boolean
Returns true if italic formatting is applied.
18 19 20 |
# File 'lib/richtext/styleable.rb', line 18 def italic? self[:italic] end |
#underlined=(u) ⇒ Object Also known as: underline=
Sets underlined to either true or false, depending on the given argument.
38 39 40 |
# File 'lib/richtext/styleable.rb', line 38 def underlined=(u) self[:underlined] = u ? true : false end |
#underlined? ⇒ Boolean Also known as: underline?
Returns true if underlined formatting is applied.
30 31 32 |
# File 'lib/richtext/styleable.rb', line 30 def underlined? self[:underlined] end |