Class: GlooLang::App::Settings
- Inherits:
-
Object
- Object
- GlooLang::App::Settings
- Defined in:
- lib/gloo_lang/app/settings.rb
Instance Attribute Summary collapse
-
#config_path ⇒ Object
readonly
Returns the value of attribute config_path.
-
#debug ⇒ Object
readonly
Returns the value of attribute debug.
-
#debug_path ⇒ Object
readonly
Returns the value of attribute debug_path.
-
#list_indent ⇒ Object
readonly
Returns the value of attribute list_indent.
-
#log_path ⇒ Object
readonly
Returns the value of attribute log_path.
-
#project_path ⇒ Object
readonly
Returns the value of attribute project_path.
-
#start_with ⇒ Object
readonly
Returns the value of attribute start_with.
-
#tmp_path ⇒ Object
readonly
Returns the value of attribute tmp_path.
-
#user_root ⇒ Object
readonly
Returns the value of attribute user_root.
Class Method Summary collapse
-
.cols(engine) ⇒ Object
Get the number of horizontal columns on screen.
-
.lines(engine) ⇒ Object
Get the number of vertical lines on screen.
-
.page_size(engine) ⇒ Object
Get the default page size.
-
.preview_lines ⇒ Object
How many lines should we use for a preview?.
Instance Method Summary collapse
-
#initialize(engine, root = nil) ⇒ Settings
constructor
Load setting from the yml file.
-
#show ⇒ Object
Show the current application settings.
-
#show_paths ⇒ Object
Show path settings.
Constructor Details
#initialize(engine, root = nil) ⇒ Settings
Load setting from the yml file. The mode parameter is used to determine if we are running in TEST.
22 23 24 25 26 27 28 29 |
# File 'lib/gloo_lang/app/settings.rb', line 22 def initialize( engine, root=nil ) @engine = engine # @mode = mode init_root( root ) init_path_settings init_user_settings end |
Instance Attribute Details
#config_path ⇒ Object (readonly)
Returns the value of attribute config_path.
13 14 15 |
# File 'lib/gloo_lang/app/settings.rb', line 13 def config_path @config_path end |
#debug ⇒ Object (readonly)
Returns the value of attribute debug.
13 14 15 |
# File 'lib/gloo_lang/app/settings.rb', line 13 def debug @debug end |
#debug_path ⇒ Object (readonly)
Returns the value of attribute debug_path.
13 14 15 |
# File 'lib/gloo_lang/app/settings.rb', line 13 def debug_path @debug_path end |
#list_indent ⇒ Object (readonly)
Returns the value of attribute list_indent.
13 14 15 |
# File 'lib/gloo_lang/app/settings.rb', line 13 def list_indent @list_indent end |
#log_path ⇒ Object (readonly)
Returns the value of attribute log_path.
13 14 15 |
# File 'lib/gloo_lang/app/settings.rb', line 13 def log_path @log_path end |
#project_path ⇒ Object (readonly)
Returns the value of attribute project_path.
13 14 15 |
# File 'lib/gloo_lang/app/settings.rb', line 13 def project_path @project_path end |
#start_with ⇒ Object (readonly)
Returns the value of attribute start_with.
13 14 15 |
# File 'lib/gloo_lang/app/settings.rb', line 13 def start_with @start_with end |
#tmp_path ⇒ Object (readonly)
Returns the value of attribute tmp_path.
13 14 15 |
# File 'lib/gloo_lang/app/settings.rb', line 13 def tmp_path @tmp_path end |
#user_root ⇒ Object (readonly)
Returns the value of attribute user_root.
13 14 15 |
# File 'lib/gloo_lang/app/settings.rb', line 13 def user_root @user_root end |
Class Method Details
.cols(engine) ⇒ Object
Get the number of horizontal columns on screen.
91 92 93 |
# File 'lib/gloo_lang/app/settings.rb', line 91 def self.cols engine engine.platform.cols end |
.lines(engine) ⇒ Object
Get the number of vertical lines on screen.
84 85 86 |
# File 'lib/gloo_lang/app/settings.rb', line 84 def self.lines engine engine.platform.lines end |
.page_size(engine) ⇒ Object
Get the default page size. This is the number of lines of text we can show.
99 100 101 |
# File 'lib/gloo_lang/app/settings.rb', line 99 def self.page_size engine Settings.lines( engine ) - 3 end |
.preview_lines ⇒ Object
How many lines should we use for a preview?
106 107 108 |
# File 'lib/gloo_lang/app/settings.rb', line 106 def self.preview_lines return 7 end |
Instance Method Details
#show ⇒ Object
Show the current application settings. Can be seen in app with ‘help settings’
35 36 37 38 39 40 41 42 43 44 |
# File 'lib/gloo_lang/app/settings.rb', line 35 def show puts "\nApplication Settings:" puts ' Startup with: ' + @start_with puts ' Indent in Listing: ' + @list_indent.to_s puts ' Screen Lines: ' + GlooLang::App::Settings.lines( @engine ).to_s puts ' Page Size: ' + GlooLang::App::Settings.page_size( @engine ).to_s puts '' self.show_paths puts '' end |
#show_paths ⇒ Object
Show path settings
49 50 51 52 53 54 |
# File 'lib/gloo_lang/app/settings.rb', line 49 def show_paths puts ' User Root Path is here: ' + @user_root puts ' Projects Path: ' + @project_path puts ' Tmp Path: ' + @tmp_path puts ' Debug Path: ' + @debug_path end |