Class: Gloo::App::Settings
- Inherits:
-
Object
- Object
- Gloo::App::Settings
- Defined in:
- lib/gloo/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.
-
#list_levels ⇒ Object
readonly
Returns the value of attribute list_levels.
-
#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.
-
#override_project_path(path) ⇒ Object
Running in app mode, so overriding the root project path.
-
#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/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/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/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/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/app/settings.rb', line 13 def list_indent @list_indent end |
#list_levels ⇒ Object (readonly)
Returns the value of attribute list_levels.
13 14 15 |
# File 'lib/gloo/app/settings.rb', line 13 def list_levels @list_levels end |
#log_path ⇒ Object (readonly)
Returns the value of attribute log_path.
13 14 15 |
# File 'lib/gloo/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/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/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/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/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.
68 69 70 |
# File 'lib/gloo/app/settings.rb', line 68 def self.cols engine engine.platform.cols end |
.lines(engine) ⇒ Object
Get the number of vertical lines on screen.
61 62 63 |
# File 'lib/gloo/app/settings.rb', line 61 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.
76 77 78 |
# File 'lib/gloo/app/settings.rb', line 76 def self.page_size engine Settings.lines( engine ) - 3 end |
.preview_lines ⇒ Object
How many lines should we use for a preview?
83 84 85 |
# File 'lib/gloo/app/settings.rb', line 83 def self.preview_lines return 7 end |
Instance Method Details
#override_project_path(path) ⇒ Object
Running in app mode, so overriding the root project path.
94 95 96 97 98 |
# File 'lib/gloo/app/settings.rb', line 94 def override_project_path path @engine.log.debug "Root project path is #{path}" @project_path = path end |
#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/app/settings.rb', line 35 def show puts "\n Application Settings:".blue puts ' Startup with: '.yellow + @start_with.white puts ' Indent in Listing: '.yellow + @list_indent.to_s.white puts ' List Levels: '.yellow + @list_levels.to_s.white puts ' Debug? '.yellow + @debug.to_s.white puts ' Screen Lines: '.yellow + Gloo::App::Settings.lines( @engine ).to_s.white puts ' Page Size: '.yellow + Gloo::App::Settings.page_size( @engine ).to_s.white self.show_paths end |
#show_paths ⇒ Object
Show path settings
49 50 51 52 53 54 55 56 |
# File 'lib/gloo/app/settings.rb', line 49 def show_paths puts "\n Application Paths:".blue puts ' User Root Path is here: '.yellow + @user_root.white puts ' Projects Path: '.yellow + @project_path.white puts ' Tmp Path: '.yellow + @tmp_path.white puts ' Debug Path: '.yellow + @debug_path.white puts "\n" end |