diff options
author | Abinoam Praxedes Marques Jr <abinoam@gmail.com> | 2015-12-14 11:25:20 -0300 |
---|---|---|
committer | Abinoam Praxedes Marques Jr <abinoam@gmail.com> | 2015-12-14 11:25:20 -0300 |
commit | ab02507667ba46fbe71e430c59253d1deb1635f0 (patch) | |
tree | 0772d19969406e466015fc48be818e5ecb9006f2 | |
parent | d39ec835fb25c9fd7b178716d24ea8694026e23a (diff) | |
download | highline-ab02507667ba46fbe71e430c59253d1deb1635f0.tar.gz |
Improve HighLine::Statement documentation
-rw-r--r-- | lib/highline/statement.rb | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/lib/highline/statement.rb b/lib/highline/statement.rb index 870495c..f3df34f 100644 --- a/lib/highline/statement.rb +++ b/lib/highline/statement.rb @@ -4,20 +4,42 @@ require 'highline/wrapper' require 'highline/paginator' require 'highline/template_renderer' +# This class handles proper formatting based +# on a HighLine context, applying wrapping, +# pagination, indentation and color rendering +# when necessary. It's used by {HighLine#render_statement} +# @see HighLine#render_statement class HighLine::Statement - attr_reader :source, :highline + # The source object to be stringfied and formatted. + attr_reader :source + + # The HighLine context + # @return [HighLine] + attr_reader :highline + + # The stringfied source object + # @return [String] attr_reader :template_string + # It needs the input String and the HighLine context + # @param source [#to_s] + # @param highline [HighLine] context def initialize(source, highline) @highline = highline @source = source @template_string = stringfy(source) end + # Returns the formated statement. + # Applies wrapping, pagination, indentation and color rendering + # based on HighLine instance settings. + # @return [String] formated statement def statement @statement ||= format_statement end + # (see #statement) + # Delegates to {#statement} def to_s statement end |