Class: HighLine::Statement
Overview
This class handles proper formatting based on a HighLine context, applying wrapping, pagination, indentation and color rendering when necessary. It’s used by #render_statement
Instance Attribute Summary collapse
-
#highline ⇒ HighLine
readonly
The HighLine context.
-
#source ⇒ Object
readonly
The source object to be stringfied and formatted.
-
#template_string ⇒ String
readonly
The stringfied source object.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(source, highline) ⇒ Statement
constructor
It needs the input String and the HighLine context.
-
#statement ⇒ String
Returns the formated statement.
-
#to_s ⇒ String
Returns the formated statement.
Constructor Details
#initialize(source, highline) ⇒ Statement
It needs the input String and the HighLine context
28 29 30 31 32 |
# File 'lib/highline/statement.rb', line 28 def initialize(source, highline) @highline = highline @source = source @template_string = stringfy(source) end |
Instance Attribute Details
#highline ⇒ HighLine (readonly)
The HighLine context
19 20 21 |
# File 'lib/highline/statement.rb', line 19 def highline @highline end |
#source ⇒ Object (readonly)
The source object to be stringfied and formatted.
15 16 17 |
# File 'lib/highline/statement.rb', line 15 def source @source end |
#template_string ⇒ String (readonly)
The stringfied source object
23 24 25 |
# File 'lib/highline/statement.rb', line 23 def template_string @template_string end |
Class Method Details
Instance Method Details
#statement ⇒ String
Returns the formated statement. Applies wrapping, pagination, indentation and color rendering based on HighLine instance settings.
38 39 40 |
# File 'lib/highline/statement.rb', line 38 def statement @statement ||= format_statement end |
#to_s ⇒ String
Returns the formated statement. Applies wrapping, pagination, indentation and color rendering based on HighLine instance settings. Delegates to #statement
44 45 46 |
# File 'lib/highline/statement.rb', line 44 def to_s statement end |