zabbirc 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 11ac19c79191e2fe87ffb43749fb6f92217eaf13
4
- data.tar.gz: 378b42d0728fe9ceb3b01e337dcd468939c5eb0b
3
+ metadata.gz: 518148802e14cf99f7647af570629636edb961e3
4
+ data.tar.gz: 4d130e7ecf9d6dc962473f3e8cadf6fd6add5363
5
5
  SHA512:
6
- metadata.gz: 9a0c5cace32e565a365dca2b9dcbd023073e0d4f8450c2dfe1c6609c5383f6d992005ea30c96bf038981d5a6f06653e09d5ce15c921a1d732ca60aee3e2e08f2
7
- data.tar.gz: 835ad3ee7213973e670ad79d7bd55b32349114befa11445ad74ae613acc5aa006ce7d6485b22f33e7ee4dbf2585d381205c100cd4f1c167625fca9aaf2200cc2
6
+ metadata.gz: 7197e4008929e5d9e0e76adab0360c078523dbf7552f6aeeac0662a0a65171e5fdca52be52b473594df7c4a345776683ab58716ae692ed9352c4857cd0e90ae7
7
+ data.tar.gz: 2d0c49eebd46b7f26d73682d9304bc24b05fc4413955bd20ad4d7cfabe5b524e05d13a85fccc21d728567f6c8d736c02f092a9421cb684d6c331b061485ecf82
@@ -1,5 +1,7 @@
1
1
  require 'active_support/configurable'
2
2
 
3
+ require 'zabbirc/priority'
4
+
3
5
  module Zabbirc
4
6
  def self.configure(&block)
5
7
  block.call(@config ||= Zabbirc::Configuration.new)
@@ -26,6 +28,18 @@ module Zabbirc
26
28
  config.param_name.respond_to?(:call) ? config.param_name.call : config.param_name
27
29
  end
28
30
 
31
+ def default_events_priority= value
32
+ allowed_priorities = Priority::PRIORITIES.values
33
+ unless allowed_priorities.include? value
34
+ raise ArgumentError, "Unexpected value in config file. default_events_priority can be one of `#{allowed_priorities.collect(&:inspect).join(", ")}` but `#{value.inspect}` was stated"
35
+ end
36
+ config.default_events_priority = value
37
+ end
38
+
39
+ def default_events_priority
40
+ config.default_events_priority
41
+ end
42
+
29
43
  # define param_name writer (copied from AS::Configurable)
30
44
  writer, line = 'def param_name=(value); config.param_name = value; end', __LINE__
31
45
  singleton_class.class_eval writer, __FILE__, line
@@ -36,6 +50,7 @@ module Zabbirc
36
50
  configure do |config|
37
51
  config.events_check_interval = 10.seconds
38
52
  config.notify_about_events_from_last = 5.minutes
53
+ config.default_events_priority = :high
39
54
 
40
55
  config.irc_server = "irc.freenode.org"
41
56
  config.irc_channels = ["#zabbirc-test", "#zabbirc-test-2"]
@@ -3,7 +3,7 @@ module Zabbirc
3
3
  DEFAULTS = ActiveSupport::HashWithIndifferentAccess.new({
4
4
  notify: true,
5
5
  primary_channel: nil,
6
- events_priority: :information
6
+ events_priority: Zabbirc.config.default_events_priority
7
7
  })
8
8
 
9
9
  def initialize
@@ -11,4 +11,5 @@ Zabbirc.configure do |config|
11
11
  ### Zabbirc configurations
12
12
  # config.events_check_interval = 10.seconds
13
13
  # config.notify_about_events_from_last = 5.minutes
14
+ # config.default_events_priority = :high
14
15
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zabbirc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Filip Zachar
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-04 00:00:00.000000000 Z
11
+ date: 2014-12-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport