Module: Weechat::Script::Skeleton::InstanceMethods

Defined in:
lib/weechat/script.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) weechat_init



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/weechat/script.rb', line 28

def weechat_init
  if (self.script[:gem_version].split('.').map{|i| i.to_i} <=> Weechat::VERSION.split('.').map{|i| i.to_i}) > 0
    Weechat.puts "This script ('#{self.script[:name]}') "\
    "requires a version of the weechat ruby gem of at least #{self.script[:gem_version]}. "\
    "You are currently using the version #{Weechat::VERSION}"
    return Weechat::WEECHAT_RC_ERROR
  end

  ret = Weechat.register(self.script[:name],
                         self.script[:author],
                         self.script[:version],
                         self.script[:license],
                         self.script[:description],
                         'weechat_script_unload',
                         self.script[:charset])
  if Weechat.integer_to_bool(ret)
    self.config.set_script_name!(self.script[:name])
    self.config.init!
    if respond_to?(:setup)
      return Weechat::Utilities.evaluate_call { setup }
    end

    return Weechat::WEECHAT_RC_OK
  end
end

- (Object) weechat_script_unload



54
55
56
57
58
59
60
# File 'lib/weechat/script.rb', line 54

def weechat_script_unload
  if respond_to?(:teardown)
    return Weechat::Utilities.evaluate_call { teardown }
  end

  return Weechat::WEECHAT_RC_OK
end