blabbermouth 0.0.11 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/blabbermouth.rb +5 -5
- data/lib/blabbermouth/blabber.rb +1 -1
- data/lib/blabbermouth/version.rb +1 -1
- metadata +16 -3
- data/lib/blabbermouth/configuration.rb +0 -67
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 682a647371f19a4e12e20a46dd7860266b58cc0f
|
4
|
+
data.tar.gz: 28685789e997a84b6d404647b1352f0283d2a422
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd95d145e8f4ebc640d7725f8111962cf8eb458dc4024cdd8838640f054da7d6f24df9849b80b48c4ab5ad336e1eb6c512aa91ee6bee2946bff55171611bee85
|
7
|
+
data.tar.gz: 891ace7150779f073880999f69270c9412b5e595ca034132a1f32bd1fa395b2bc108afd61aed563141f7b497fa54870c21f2e6cc7fa30146eecad8e60c1b3059
|
data/lib/blabbermouth.rb
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
require 'active_support/core_ext/module/attribute_accessors'
|
2
2
|
require 'active_support/core_ext/array/extract_options'
|
3
3
|
require 'active_support/core_ext/string'
|
4
|
+
require 'canfig'
|
4
5
|
require 'blabbermouth/version'
|
5
|
-
require 'blabbermouth/configuration'
|
6
6
|
require 'blabbermouth/bystanders'
|
7
7
|
require 'blabbermouth/blabber'
|
8
8
|
|
9
9
|
module Blabbermouth
|
10
|
-
|
11
|
-
@@configuration = Blabbermouth::Configuration.new
|
10
|
+
include Canfig::Module
|
12
11
|
|
13
|
-
|
14
|
-
|
12
|
+
configure do |config|
|
13
|
+
config.bystanders = [:stdout]
|
14
|
+
config.gagged = false
|
15
15
|
end
|
16
16
|
|
17
17
|
def self.blabber(*bystanders)
|
data/lib/blabbermouth/blabber.rb
CHANGED
@@ -105,7 +105,7 @@ module Blabbermouth
|
|
105
105
|
bystanders.map do |bystander|
|
106
106
|
next unless bystander.respond_to?(meth)
|
107
107
|
bystander_args = args.dup.push(bystander_options(bystander, opts))
|
108
|
-
bystander.send meth, key, *bystander_args, &block
|
108
|
+
bystander.send meth, key, *bystander_args, &block unless Blabbermouth.configuration.gagged == true
|
109
109
|
end
|
110
110
|
end
|
111
111
|
|
data/lib/blabbermouth/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blabbermouth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark Rebec
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: canfig
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: rake
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -68,7 +82,6 @@ files:
|
|
68
82
|
- lib/blabbermouth/bystanders/dynamic_events.rb
|
69
83
|
- lib/blabbermouth/bystanders/formatter.rb
|
70
84
|
- lib/blabbermouth/bystanders/stdout.rb
|
71
|
-
- lib/blabbermouth/configuration.rb
|
72
85
|
- lib/blabbermouth/exceptions.rb
|
73
86
|
- lib/blabbermouth/version.rb
|
74
87
|
- spec/blabbermouth/blabber_spec.rb
|
@@ -1,67 +0,0 @@
|
|
1
|
-
module Blabbermouth
|
2
|
-
class Configuration
|
3
|
-
DEFAULT_CONFIGURATION_OPTIONS = {
|
4
|
-
bystanders: [:stdout]
|
5
|
-
}
|
6
|
-
|
7
|
-
attr_reader *DEFAULT_CONFIGURATION_OPTIONS.keys
|
8
|
-
|
9
|
-
DEFAULT_CONFIGURATION_OPTIONS.keys.each do |key|
|
10
|
-
define_method "#{key.to_s}=" do |val|
|
11
|
-
@changed[key] = [send(key), val]
|
12
|
-
instance_variable_set "@#{key.to_s}", val
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
def changed
|
17
|
-
@changed = {}
|
18
|
-
to_hash.each { |key,val| @changed[key] = [@saved_state[key], val] if @saved_state[key] != val }
|
19
|
-
@changed
|
20
|
-
end
|
21
|
-
|
22
|
-
def changed?(key)
|
23
|
-
changed.has_key?(key)
|
24
|
-
end
|
25
|
-
|
26
|
-
def configure(args={}, &block)
|
27
|
-
save_state
|
28
|
-
configure_with_args args
|
29
|
-
configure_with_block &block
|
30
|
-
self
|
31
|
-
end
|
32
|
-
|
33
|
-
def configure_with_args(args)
|
34
|
-
args.select { |k,v| DEFAULT_CONFIGURATION_OPTIONS.keys.include?(k) }.each do |key,val|
|
35
|
-
instance_variable_set "@#{key.to_s}", val
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
def configure_with_block(&block)
|
40
|
-
self.instance_eval(&block) if block_given?
|
41
|
-
end
|
42
|
-
|
43
|
-
def save_state
|
44
|
-
@saved_state = clone.to_hash
|
45
|
-
@changed = {}
|
46
|
-
end
|
47
|
-
|
48
|
-
|
49
|
-
def to_hash
|
50
|
-
h = {}
|
51
|
-
DEFAULT_CONFIGURATION_OPTIONS.keys.each do |key|
|
52
|
-
h[key] = instance_variable_get "@#{key.to_s}"
|
53
|
-
end
|
54
|
-
h
|
55
|
-
end
|
56
|
-
alias_method :to_h, :to_hash
|
57
|
-
|
58
|
-
protected
|
59
|
-
|
60
|
-
def initialize
|
61
|
-
DEFAULT_CONFIGURATION_OPTIONS.each do |key,val|
|
62
|
-
instance_variable_set "@#{key.to_s}", val
|
63
|
-
end
|
64
|
-
save_state
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|