Class: Weechat::Bar

Inherits:
Object
  • Object
show all
Extended by:
Properties
Includes:
Pointer
Defined in:
lib/weechat/bar.rb

Defined Under Namespace

Classes: Item

Instance Attribute Summary

Attributes included from Pointer

#ptr

Class Method Summary collapse

Instance Method Summary collapse

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

#initialize(args = {}) ⇒ Bar

eigenclass



139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# File 'lib/weechat/bar.rb', line 139

def initialize(args = {})
  mapped_args = {}
  args.each do |key, value|
    mapped_args[key] = self.class.apply_rtransformation(key, value)
  end

  @ptr = Weechat.bar_new(*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

  @name = args[:name]
end

Class Method Details

.find(name) ⇒ Object Also known as: from_name



128
129
130
131
132
133
134
135
# File 'lib/weechat/bar.rb', line 128

def find(name)
  ptr = Weechat.bar_search(name)
  if !ptr.empty?
    from_ptr(ptr)
  else
    nil
  end
end

Instance Method Details

#deleteObject Also known as: remove



161
162
163
164
# File 'lib/weechat/bar.rb', line 161

def delete
  # TODO mark deletion state
  Weechat.bar_remove(@ptr)
end

#updateObject



157
158
159
# File 'lib/weechat/bar.rb', line 157

def update
  Weechat.bar_update(self.name)
end