Class: Cabriolet::Models::HLPTopic
- Inherits:
-
Object
- Object
- Cabriolet::Models::HLPTopic
- Defined in:
- lib/cabriolet/models/hlp_file.rb
Overview
QuickHelp topic model
Represents a single topic in a QuickHelp help database. Each topic contains formatted text lines with styles and hyperlinks.
Instance Attribute Summary collapse
-
#index ⇒ Object
Returns the value of attribute index.
-
#lines ⇒ Object
Returns the value of attribute lines.
-
#metadata ⇒ Object
Returns the value of attribute metadata.
-
#offset ⇒ Object
Returns the value of attribute offset.
-
#size ⇒ Object
Returns the value of attribute size.
-
#source_data ⇒ Object
Returns the value of attribute source_data.
Instance Method Summary collapse
-
#add_line(line) ⇒ void
Add a line to the topic.
-
#empty? ⇒ Boolean
Check if topic has any content.
-
#initialize(index: 0, offset: 0, size: 0) ⇒ HLPTopic
constructor
Initialize a QuickHelp topic.
-
#plain_text ⇒ String
Get plain text content (without formatting).
Constructor Details
#initialize(index: 0, offset: 0, size: 0) ⇒ HLPTopic
Initialize a QuickHelp topic
17 18 19 20 21 22 23 24 |
# File 'lib/cabriolet/models/hlp_file.rb', line 17 def initialize(index: 0, offset: 0, size: 0) @index = index @offset = offset @size = size @lines = [] @source_data = nil = {} end |
Instance Attribute Details
#index ⇒ Object
Returns the value of attribute index.
10 11 12 |
# File 'lib/cabriolet/models/hlp_file.rb', line 10 def index @index end |
#lines ⇒ Object
Returns the value of attribute lines.
10 11 12 |
# File 'lib/cabriolet/models/hlp_file.rb', line 10 def lines @lines end |
#metadata ⇒ Object
Returns the value of attribute metadata.
10 11 12 |
# File 'lib/cabriolet/models/hlp_file.rb', line 10 def end |
#offset ⇒ Object
Returns the value of attribute offset.
10 11 12 |
# File 'lib/cabriolet/models/hlp_file.rb', line 10 def offset @offset end |
#size ⇒ Object
Returns the value of attribute size.
10 11 12 |
# File 'lib/cabriolet/models/hlp_file.rb', line 10 def size @size end |
#source_data ⇒ Object
Returns the value of attribute source_data.
10 11 12 |
# File 'lib/cabriolet/models/hlp_file.rb', line 10 def source_data @source_data end |
Instance Method Details
#add_line(line) ⇒ void
This method returns an undefined value.
Add a line to the topic
44 45 46 |
# File 'lib/cabriolet/models/hlp_file.rb', line 44 def add_line(line) @lines << line end |
#empty? ⇒ Boolean
Check if topic has any content
29 30 31 |
# File 'lib/cabriolet/models/hlp_file.rb', line 29 def empty? @lines.empty? end |
#plain_text ⇒ String
Get plain text content (without formatting)
36 37 38 |
# File 'lib/cabriolet/models/hlp_file.rb', line 36 def plain_text @lines.map(&:text).join("\n") end |