Class: Weechat::Bar
- Inherits:
-
Object
- Object
- Weechat::Bar
- Extended by:
- Properties
- Includes:
- Pointer
- Defined in:
- lib/weechat/bar.rb
Defined Under Namespace
Classes: Item
Instance Attribute Summary
Attributes included from Pointer
Class Method Summary (collapse)
-
+ (Bar?) find(name)
(also: from_name)
Finds the Bar with the given name.
Instance Method Summary (collapse)
-
- (Object) delete
(also: #remove)
deletes the bar.
-
- (Bar) initialize(opts)
constructor
Creates a new Bar.
-
- (Object) update
updates the bar.
Methods included from Properties::ClassMethods
#all, #apply_rtransformation, #apply_transformation, #init_properties, #known_integer_properties, #known_properties, #known_string_properties, #mappings, #rtransformations, #settable_properties, #transformations, #type
Methods included from Pointer
#==, #hash, included, #inspect, #to_s
Constructor Details
- (Bar) initialize(opts)
Creates a new Bar. Takes many optional arguments, but only :name, :position and :items are required
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 |
# File 'lib/weechat/bar.rb', line 209 def initialize(opts) @name = opts[:name] mapped_args = {} args_with_defaults = add_defaults_to_args(opts) args_with_defaults.each do |key, value| mapped_args[key] = self.class.apply_rtransformation(key, value) end @ptr = Weechat.(*mapped_args.values_at(:name, :hidden, :priority, :type, :condition, :position, :filling_top_bottom, :filling_left_right, :size, :size_max, :color_fg, :color_delim, :color_bg, :separator, :items)) if @ptr.empty? raise "Could not create bar" end end |
Class Method Details
+ (Bar?) find(name) Also known as: from_name
Finds the Bar with the given name
163 164 165 166 167 168 169 170 |
# File 'lib/weechat/bar.rb', line 163 def find(name) ptr = Weechat.(name) if !ptr.empty? from_ptr(ptr) else nil end end |
Instance Method Details
- (Object) delete Also known as: remove
deletes the bar.
261 262 263 264 |
# File 'lib/weechat/bar.rb', line 261 def delete # TODO mark deletion state Weechat.(@ptr) end |
- (Object) update
updates the bar
256 257 258 |
# File 'lib/weechat/bar.rb', line 256 def update Weechat.(self.name) end |