class BitlbeeConfig::Channel
A channel on the bitlbee server. Can either be a control channel, in which you issue commands to the BitlBee root user, or a chat channel, which is a multi contact conversation
Attributes
name[RW]
settings[RW]
type[RW]
Public Class Methods
from_xml(xml)
click to toggle source
@param [Nokogiri::XML::Element] xml XML element to create channel from @return [BitlbeeConfig::Channel] The newly created channel
# File lib/bitlbee_config/channel.rb, line 11 def from_xml(xml) new_channel = {} # get setting attributes xml.attributes.each do |att_name, att_value| new_channel[att_name.to_sym] = att_value.text end # get setting children xml.children.select { |node| node.is_a?(Nokogiri::XML::Element) }.each do |setting_element| new_channel[setting_element.values.first.to_sym] = setting_element.text end BitlbeeConfig::Channel.new(new_channel) end
new(options = {})
click to toggle source
@param [Hash] options @option options [String] :name Channel
name. Don’t forget # or & @option options [“control”|“chat”] :type Type of channel @option options [String] All other entries will be converted to settings
# File lib/bitlbee_config/channel.rb, line 32 def initialize(options = {}) @name = options.delete(:name) @type = options.delete(:type) @settings = options || {} end
Public Instance Methods
build_xml(xml_builder)
click to toggle source
@param [Nokogiri::XML::Builder] xml_builder All XML will be added to this builder
# File lib/bitlbee_config/channel.rb, line 39 def build_xml(xml_builder) to_xml_with_options(xml_builder, name: @name, type: @type) end