Class: VimMate::Config
- Inherits:
-
Object
- Object
- VimMate::Config
- Includes:
- NiceSingleton
- Defined in:
- lib/vim_mate/config.rb
Overview
Holds the configurations for VimMate. Also read and write this configuration so the user can change it.
Constant Summary collapse
- BASE_FILENAME =
'.vimmaterc'
- DEFAULT_CONFIG =
{ :window_title => 'VimMate', :window_width => 950, :window_height => 600, :layout_big_terminals => false, :files_opened_width => 250, :files_closed_width => 25, :files_expanded => true, :file_headers_visible => false, :file_hover_selection => false, :file_directory_separator => true, :files_filter_active => true, :files_auto_expand_on_filter => false, :files_refresh_interval => 10, :files_default_open_in_tabs => true, :files_use_ellipsis => true, :files_use_search => true, :files_search_ignore_case => true, :files_search_separator_position => 400, :files_warn_too_many_files => 300, :files_warn_too_many_files_each_step => true, :files_show_status => true, :tags_refresh_interval => 5, :terminals_enabled => true, :terminals_height => 50, :terminals_font => "10", :terminals_foreground_color => "#000000", :terminals_background_color => "#FFFFDD", :terminals_audible_bell => false, :terminals_visible_bell => false, :terminals_autoexec => "", :terminals_login_shell => false, :subversion_enabled => true, }.freeze
Instance Method Summary collapse
-
#[](symbol) ⇒ Object
Easy access to the configuration hash.
-
#config ⇒ Object
Access the configuration hash.
- #images_path ⇒ Object
-
#initialize ⇒ Config
constructor
Create the Config class.
-
#lib_path ⇒ Object
Get the lib path.
Methods included from NiceSingleton
Constructor Details
#initialize ⇒ Config
Create the Config class. Cannot be called directly
70 71 72 73 74 75 76 77 78 79 |
# File 'lib/vim_mate/config.rb', line 70 def initialize # Set the full path to the configuration file. In the user's # HOME or the current directory if ENV['HOME'] self.class.const_set(:FILENAME, File.join(ENV['HOME'], BASE_FILENAME)) else self.class.const_set(:FILENAME, BASE_FILENAME) end @config = DEFAULT_CONFIG.dup end |
Instance Method Details
#[](symbol) ⇒ Object
Easy access to the configuration hash
91 92 93 |
# File 'lib/vim_mate/config.rb', line 91 def [](symbol) config[symbol.to_sym] end |
#config ⇒ Object
Access the configuration hash
82 83 84 85 86 87 88 |
# File 'lib/vim_mate/config.rb', line 82 def config read_config #@config.freeze # Once read, we only need a simple reader self.class.send(:attr_reader, :config) config end |
#images_path ⇒ Object
100 101 102 |
# File 'lib/vim_mate/config.rb', line 100 def images_path File.(File.dirname(__FILE__) + '/../../images') end |
#lib_path ⇒ Object
Get the lib path
96 97 98 |
# File 'lib/vim_mate/config.rb', line 96 def lib_path File.dirname(File.(__FILE__)) end |