Class: GlooLang::App::Settings

Inherits:
Object
  • Object
show all
Defined in:
lib/gloo_lang/app/settings.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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
  
end

Instance Attribute Details

#config_pathObject (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

#debugObject (readonly)

Returns the value of attribute debug.



13
14
15
# File 'lib/gloo_lang/app/settings.rb', line 13

def debug
  @debug
end

#debug_pathObject (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_indentObject (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_pathObject (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_pathObject (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_withObject (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_pathObject (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_rootObject (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_linesObject

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

#showObject

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_pathsObject

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