notifaction 0.4.2 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/notifaction/config.rb +24 -4
- data/lib/notifaction/helpers.rb +1 -1
- data/lib/notifaction/types/terminal.rb +3 -3
- data/lib/notifaction/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e5439ba63abc58af06453e917aad30bc194eefdd
|
4
|
+
data.tar.gz: a3f1c3e082aa9627b890521b6e9db47fe1f31989
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 53d8f23d81ee7681ec932e7fe3ed6527dc7123b39a95a917a4032abb0ec1b66683ca7fff1ceaaf7b69907adedf5190d50d71184c733117c3a162a378778d2727
|
7
|
+
data.tar.gz: 8309bd266ae92874eefa6b949b47bce806d3c7f675550e5a959b16c9c3e92c4044b4be171ecf5426e30e688a97c2af1b0e63c71993b5192043e07be8bbbfbcbf
|
data/lib/notifaction/config.rb
CHANGED
@@ -2,18 +2,38 @@ require "yaml"
|
|
2
2
|
|
3
3
|
module Notifaction
|
4
4
|
class Cfg
|
5
|
-
attr_reader :hooks, :conf
|
6
|
-
|
7
5
|
#
|
8
6
|
# @since 0.4.0
|
9
7
|
def initialize
|
10
8
|
local_conf = Dir.home + "/.notifaction.yml"
|
9
|
+
|
10
|
+
conf = {}
|
11
11
|
conf = YAML.load(File.open(local_conf)) if File.exists? local_conf
|
12
12
|
|
13
|
-
@hooks = conf["hooks"]
|
14
|
-
@
|
13
|
+
@hooks = conf["hooks"] ||= []
|
14
|
+
@config = conf["config"] ||= {}
|
15
15
|
|
16
16
|
nil
|
17
17
|
end
|
18
|
+
|
19
|
+
#
|
20
|
+
# @since 0.4.3
|
21
|
+
def hook(item)
|
22
|
+
return if @hooks.empty? || item.nil?
|
23
|
+
@hooks[item.to_sym]
|
24
|
+
end
|
25
|
+
|
26
|
+
#
|
27
|
+
# @since 0.4.3
|
28
|
+
def hooks
|
29
|
+
@hooks
|
30
|
+
end
|
31
|
+
|
32
|
+
#
|
33
|
+
# @since 0.4.3
|
34
|
+
def config(item)
|
35
|
+
return if @config.empty? || item.nil?
|
36
|
+
@config[item.to_sym]
|
37
|
+
end
|
18
38
|
end
|
19
39
|
end
|
data/lib/notifaction/helpers.rb
CHANGED
@@ -14,7 +14,7 @@ module Notifaction
|
|
14
14
|
# Should method exit with Type::QUIT? Mainly used in tests
|
15
15
|
# @since 0.4.1
|
16
16
|
def auto_quit_enabled?(config, user_conf)
|
17
|
-
config[:auto_quit] == false || user_conf.
|
17
|
+
config[:auto_quit] == false || user_conf.config("auto_quit") == false
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
@@ -84,19 +84,19 @@ module Notifaction
|
|
84
84
|
#
|
85
85
|
# @since 0.4.0
|
86
86
|
def show_symbol(config)
|
87
|
-
config[:symbol] || config[:fancy] || @user_conf.
|
87
|
+
config[:symbol] || config[:fancy] || @user_conf.config("fancy") == true
|
88
88
|
end
|
89
89
|
|
90
90
|
#
|
91
91
|
# @since 0.4.0
|
92
92
|
def show_time(config)
|
93
|
-
config[:show_time] || @user_conf.
|
93
|
+
config[:show_time] || @user_conf.config("show_time")
|
94
94
|
end
|
95
95
|
|
96
96
|
#
|
97
97
|
# @since 0.4.0
|
98
98
|
def show_message(config)
|
99
|
-
config[:print] == false || @user_conf.
|
99
|
+
config[:print] == false || @user_conf.config("print") == false
|
100
100
|
end
|
101
101
|
end
|
102
102
|
end
|
data/lib/notifaction/version.rb
CHANGED