Class: HammerCLI::Help::AbstractItem
- Inherits:
-
Object
- Object
- HammerCLI::Help::AbstractItem
- Defined in:
- lib/hammer_cli/help/definition/abstract_item.rb
Constant Summary collapse
- INDENT_STEP =
2
Instance Attribute Summary collapse
-
#definition ⇒ Object
Returns the value of attribute definition.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#richtext ⇒ Object
readonly
Returns the value of attribute richtext.
Class Method Summary collapse
Instance Method Summary collapse
- #build_string ⇒ Object
-
#initialize(options = {}) ⇒ AbstractItem
constructor
A new instance of AbstractItem.
Constructor Details
#initialize(options = {}) ⇒ AbstractItem
Returns a new instance of AbstractItem.
9 10 11 12 13 |
# File 'lib/hammer_cli/help/definition/abstract_item.rb', line 9 def initialize( = {}) @id = [:id] @indentation = [:indentation] @richtext = [:richtext] || false end |
Instance Attribute Details
#definition ⇒ Object
Returns the value of attribute definition.
7 8 9 |
# File 'lib/hammer_cli/help/definition/abstract_item.rb', line 7 def definition @definition end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
6 7 8 |
# File 'lib/hammer_cli/help/definition/abstract_item.rb', line 6 def id @id end |
#richtext ⇒ Object (readonly)
Returns the value of attribute richtext.
6 7 8 |
# File 'lib/hammer_cli/help/definition/abstract_item.rb', line 6 def richtext @richtext end |
Class Method Details
.indent(content, indentation = nil) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/hammer_cli/help/definition/abstract_item.rb', line 19 def self.indent(content, indentation = nil) indentation ||= ' ' * INDENT_STEP content = content.split("\n") unless content.is_a? Array content.map do |line| (indentation + line).rstrip end.join("\n") end |
Instance Method Details
#build_string ⇒ Object
15 16 17 |
# File 'lib/hammer_cli/help/definition/abstract_item.rb', line 15 def build_string raise NotImplementedError end |