Class: Cabriolet::Models::TextAttribute
- Inherits:
-
Object
- Object
- Cabriolet::Models::TextAttribute
- Defined in:
- lib/cabriolet/models/hlp_file.rb
Overview
Text attribute model
Represents style and link information for a single character.
Instance Attribute Summary collapse
-
#link ⇒ Object
Returns the value of attribute link.
-
#style ⇒ Object
Returns the value of attribute style.
Instance Method Summary collapse
-
#bold? ⇒ Boolean
Check if character is bold.
-
#initialize(style = 0, link = nil) ⇒ TextAttribute
constructor
Initialize text attribute.
-
#italic? ⇒ Boolean
Check if character is italic.
-
#linked? ⇒ Boolean
Check if character has a link.
-
#underline? ⇒ Boolean
Check if character is underlined.
Constructor Details
#initialize(style = 0, link = nil) ⇒ TextAttribute
Initialize text attribute
109 110 111 112 |
# File 'lib/cabriolet/models/hlp_file.rb', line 109 def initialize(style = 0, link = nil) @style = style @link = link end |
Instance Attribute Details
#link ⇒ Object
Returns the value of attribute link.
103 104 105 |
# File 'lib/cabriolet/models/hlp_file.rb', line 103 def link @link end |
#style ⇒ Object
Returns the value of attribute style.
103 104 105 |
# File 'lib/cabriolet/models/hlp_file.rb', line 103 def style @style end |
Instance Method Details
#bold? ⇒ Boolean
Check if character is bold
117 118 119 |
# File 'lib/cabriolet/models/hlp_file.rb', line 117 def bold? @style.anybits?(Binary::HLPStructures::TextStyle::BOLD) end |
#italic? ⇒ Boolean
Check if character is italic
124 125 126 |
# File 'lib/cabriolet/models/hlp_file.rb', line 124 def italic? @style.anybits?(Binary::HLPStructures::TextStyle::ITALIC) end |
#linked? ⇒ Boolean
Check if character has a link
138 139 140 |
# File 'lib/cabriolet/models/hlp_file.rb', line 138 def linked? !@link.nil? end |
#underline? ⇒ Boolean
Check if character is underlined
131 132 133 |
# File 'lib/cabriolet/models/hlp_file.rb', line 131 def underline? @style.anybits?(Binary::HLPStructures::TextStyle::UNDERLINE) end |