Class: VimMate::Icons
- Inherits:
-
Object
- Object
- VimMate::Icons
- Includes:
- NiceSingleton
- Defined in:
- lib/vim_mate/icons.rb
Overview
Manages the icons that can be loaded from the disk
Constant Summary collapse
- WINDOW_ICON_FILENAME =
The filenames for the icons of the windows
'vimmate%d.png'.freeze
- WINDOW_ICON_SIZES =
The size for the icons of the windows
[16, 32, 48].freeze
- Overlays =
%w(scm progress type)
Instance Method Summary collapse
- #by_name(icon_name) ⇒ Object
- #free_position ⇒ Object
-
#initialize ⇒ Icons
constructor
Create the Icons class.
- #method_missing(meth, *args, &block) ⇒ Object
-
#window_icons ⇒ Object
Get an array of icons for the windows.
Methods included from NiceSingleton
Constructor Details
#initialize ⇒ Icons
Create the Icons class. Cannot be called directly
38 39 40 |
# File 'lib/vim_mate/icons.rb', line 38 def initialize @gtk_window_icons = [] end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args, &block) ⇒ Object
55 56 57 58 59 60 61 62 63 |
# File 'lib/vim_mate/icons.rb', line 55 def method_missing(meth, *args, &block) if meth.to_s =~ /_overlayed_with_/ (meth, *args) elsif meth.to_s =~ /_icon$/ build_icon(meth) else raise NoMethodError, "method not found: #{meth}" end end |
Instance Method Details
#by_name(icon_name) ⇒ Object
70 71 72 |
# File 'lib/vim_mate/icons.rb', line 70 def by_name(icon_name) send (icon_name =~ /_icon$/) ? icon_name : "#{icon_name}_icon" end |
#free_position ⇒ Object
65 66 67 68 |
# File 'lib/vim_mate/icons.rb', line 65 def free_position @free_overlays ||= Overlays.dup @free_overlays.pop end |
#window_icons ⇒ Object
Get an array of icons for the windows
43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/vim_mate/icons.rb', line 43 def window_icons # Load them load_window_icons @gtk_window_icons.freeze # Once loaded, we only need a reader self.class.send(:define_method, :window_icons) do @gtk_window_icons end # Return the value window_icons end |