Class: Bovem::Console
- Inherits:
-
Object
- Object
- Bovem::Console
- Includes:
- Bovem::ConsoleMethods::Interactions, Bovem::ConsoleMethods::Logging, Bovem::ConsoleMethods::Output, Bovem::ConsoleMethods::StyleHandling, Lazier::I18n
- Defined in:
- lib/bovem/console.rb
Overview
This is a text utility wrapper console I/O.
Instance Attribute Summary collapse
-
#indentation ⇒ Fixnum
Current indentation width.
-
#indentation_string ⇒ String
The string used for indentation.
-
#line_width ⇒ Fixnum
The line width.
-
#screen_width ⇒ Fixnum
The current screen width.
Class Method Summary collapse
-
.instance ⇒ Console
Returns a unique instance for Console.
Instance Method Summary collapse
-
#initialize ⇒ Console
constructor
Initializes a new Console.
Methods included from Bovem::ConsoleMethods::Interactions
Methods included from Bovem::ConsoleMethods::Logging
#begin, #debug, #error, #fatal, #get_banner, #info, #status, #warn, #write, #write_banner_aligned
Methods included from Bovem::ConsoleMethods::Output
#format, #format_right, #get_screen_width, #indent, #reset_indentation, #set_indentation, #with_indentation, #wrap
Methods included from Bovem::ConsoleMethods::StyleHandling
Constructor Details
#initialize ⇒ Console
Initializes a new Console.
640 641 642 643 644 645 646 |
# File 'lib/bovem/console.rb', line 640 def initialize @line_width = self.get_screen_width @indentation = 0 @indentation_string = " " @stty = ::Bovem::Console.execute("which stty").strip self.i18n_setup(:bovem, ::File.absolute_path(::Pathname.new(::File.dirname(__FILE__)).to_s + "/../../locales/")) end |
Instance Attribute Details
#indentation ⇒ Fixnum
Returns Current indentation width.
620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 |
# File 'lib/bovem/console.rb', line 620 class Console attr_accessor :line_width attr_accessor :screen_width attr_accessor :indentation attr_accessor :indentation_string include Lazier::I18n include Bovem::ConsoleMethods::StyleHandling include Bovem::ConsoleMethods::Output include Bovem::ConsoleMethods::Logging include Bovem::ConsoleMethods::Interactions # Returns a unique instance for Console. # # @return [Console] A new instance. def self.instance @instance ||= ::Bovem::Console.new end # Initializes a new Console. def initialize @line_width = self.get_screen_width @indentation = 0 @indentation_string = " " @stty = ::Bovem::Console.execute("which stty").strip self.i18n_setup(:bovem, ::File.absolute_path(::Pathname.new(::File.dirname(__FILE__)).to_s + "/../../locales/")) end end |
#indentation_string ⇒ String
Returns The string used for indentation.
620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 |
# File 'lib/bovem/console.rb', line 620 class Console attr_accessor :line_width attr_accessor :screen_width attr_accessor :indentation attr_accessor :indentation_string include Lazier::I18n include Bovem::ConsoleMethods::StyleHandling include Bovem::ConsoleMethods::Output include Bovem::ConsoleMethods::Logging include Bovem::ConsoleMethods::Interactions # Returns a unique instance for Console. # # @return [Console] A new instance. def self.instance @instance ||= ::Bovem::Console.new end # Initializes a new Console. def initialize @line_width = self.get_screen_width @indentation = 0 @indentation_string = " " @stty = ::Bovem::Console.execute("which stty").strip self.i18n_setup(:bovem, ::File.absolute_path(::Pathname.new(::File.dirname(__FILE__)).to_s + "/../../locales/")) end end |
#line_width ⇒ Fixnum
Returns The line width. Default to 80.
620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 |
# File 'lib/bovem/console.rb', line 620 class Console attr_accessor :line_width attr_accessor :screen_width attr_accessor :indentation attr_accessor :indentation_string include Lazier::I18n include Bovem::ConsoleMethods::StyleHandling include Bovem::ConsoleMethods::Output include Bovem::ConsoleMethods::Logging include Bovem::ConsoleMethods::Interactions # Returns a unique instance for Console. # # @return [Console] A new instance. def self.instance @instance ||= ::Bovem::Console.new end # Initializes a new Console. def initialize @line_width = self.get_screen_width @indentation = 0 @indentation_string = " " @stty = ::Bovem::Console.execute("which stty").strip self.i18n_setup(:bovem, ::File.absolute_path(::Pathname.new(::File.dirname(__FILE__)).to_s + "/../../locales/")) end end |
#screen_width ⇒ Fixnum
Returns The current screen width.
620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 |
# File 'lib/bovem/console.rb', line 620 class Console attr_accessor :line_width attr_accessor :screen_width attr_accessor :indentation attr_accessor :indentation_string include Lazier::I18n include Bovem::ConsoleMethods::StyleHandling include Bovem::ConsoleMethods::Output include Bovem::ConsoleMethods::Logging include Bovem::ConsoleMethods::Interactions # Returns a unique instance for Console. # # @return [Console] A new instance. def self.instance @instance ||= ::Bovem::Console.new end # Initializes a new Console. def initialize @line_width = self.get_screen_width @indentation = 0 @indentation_string = " " @stty = ::Bovem::Console.execute("which stty").strip self.i18n_setup(:bovem, ::File.absolute_path(::Pathname.new(::File.dirname(__FILE__)).to_s + "/../../locales/")) end end |