inspector_gadget 0.0.1
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.
- data/.gitignore +3 -0
- data/Gemfile +4 -0
- data/Rakefile +2 -0
- data/inspector_gadget.gemspec +22 -0
- data/lib/inspector_gadget/version.rb +3 -0
- data/lib/inspector_gadget.rb +40 -0
- metadata +90 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Rakefile
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
|
2
|
+
require File.expand_path("../lib/inspector_gadget/version", __FILE__)
|
|
3
|
+
|
|
4
|
+
Gem::Specification.new do |s|
|
|
5
|
+
s.name = "inspector_gadget"
|
|
6
|
+
s.version = InspectorGadget::VERSION
|
|
7
|
+
s.platform = Gem::Platform::RUBY
|
|
8
|
+
s.authors = ['mdobrota@tribune.com']
|
|
9
|
+
s.email = ['mdobrota@tribune.com']
|
|
10
|
+
s.homepage = "http://rubygems.org/gems/inspector_gadget"
|
|
11
|
+
s.summary = "Inspect any object's methods by including the module"
|
|
12
|
+
s.description = "Inspect any object's methods"
|
|
13
|
+
|
|
14
|
+
s.required_rubygems_version = ">= 1.3.6"
|
|
15
|
+
s.rubyforge_project = "inspector_gadget"
|
|
16
|
+
|
|
17
|
+
s.add_development_dependency "bundler", ">= 1.0.0"
|
|
18
|
+
|
|
19
|
+
s.files = `git ls-files`.split("\n")
|
|
20
|
+
s.executables = `git ls-files`.split("\n").map{|f| f =~ /^bin\/(.*)/ ? $1 : nil}.compact
|
|
21
|
+
s.require_path = 'lib'
|
|
22
|
+
end
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
module InspectorGadget
|
|
2
|
+
def self.included(base)
|
|
3
|
+
base.class_eval do
|
|
4
|
+
# setting up alias_method_chain
|
|
5
|
+
(instance_methods - Object.methods).each do |method_name|
|
|
6
|
+
method_name = method_name.to_s # convert symbol to string
|
|
7
|
+
if ['?', '='].include?(method_name[-1])
|
|
8
|
+
special_character = method_name[-1]
|
|
9
|
+
bare_method_name = method_name[0..-2] # get rid of trailing "=" or "?"
|
|
10
|
+
method_with_logging_name = bare_method_name + '_with_logging' + special_character
|
|
11
|
+
method_without_logging_name = bare_method_name + '_without_logging' + special_character
|
|
12
|
+
else
|
|
13
|
+
method_with_logging_name = method_name + '_with_logging'
|
|
14
|
+
method_without_logging_name = method_name + '_without_logging'
|
|
15
|
+
end
|
|
16
|
+
define_method(method_with_logging_name) do |*args|
|
|
17
|
+
args_to_log = args.dup
|
|
18
|
+
filter_args(method_name, args_to_log)
|
|
19
|
+
Rails.logger.info "LDAP LOG: method name: #{method_name}, args: #{args_to_log.inspect}"
|
|
20
|
+
result = send(method_without_logging_name, *args)
|
|
21
|
+
result_to_log = result.dup rescue result
|
|
22
|
+
filter_result(method_name, result_to_log)
|
|
23
|
+
Rails.logger.info "LDAP LOG: method name: #{method_name}, args: #{args_to_log.inspect} returned #{result_to_log.inspect}"
|
|
24
|
+
result
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
alias_method_chain method_name, :logging
|
|
28
|
+
|
|
29
|
+
# override this method to hide passwords etc
|
|
30
|
+
def filter_args(method_name, args)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# override this method to hide passwords etc
|
|
34
|
+
def filter_result(method_name, result)
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
metadata
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: inspector_gadget
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
hash: 29
|
|
5
|
+
prerelease: false
|
|
6
|
+
segments:
|
|
7
|
+
- 0
|
|
8
|
+
- 0
|
|
9
|
+
- 1
|
|
10
|
+
version: 0.0.1
|
|
11
|
+
platform: ruby
|
|
12
|
+
authors:
|
|
13
|
+
- mdobrota@tribune.com
|
|
14
|
+
autorequire:
|
|
15
|
+
bindir: bin
|
|
16
|
+
cert_chain: []
|
|
17
|
+
|
|
18
|
+
date: 2012-10-29 00:00:00 -05:00
|
|
19
|
+
default_executable:
|
|
20
|
+
dependencies:
|
|
21
|
+
- !ruby/object:Gem::Dependency
|
|
22
|
+
name: bundler
|
|
23
|
+
prerelease: false
|
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
|
25
|
+
none: false
|
|
26
|
+
requirements:
|
|
27
|
+
- - ">="
|
|
28
|
+
- !ruby/object:Gem::Version
|
|
29
|
+
hash: 23
|
|
30
|
+
segments:
|
|
31
|
+
- 1
|
|
32
|
+
- 0
|
|
33
|
+
- 0
|
|
34
|
+
version: 1.0.0
|
|
35
|
+
type: :development
|
|
36
|
+
version_requirements: *id001
|
|
37
|
+
description: Inspect any object's methods
|
|
38
|
+
email:
|
|
39
|
+
- mdobrota@tribune.com
|
|
40
|
+
executables: []
|
|
41
|
+
|
|
42
|
+
extensions: []
|
|
43
|
+
|
|
44
|
+
extra_rdoc_files: []
|
|
45
|
+
|
|
46
|
+
files:
|
|
47
|
+
- .gitignore
|
|
48
|
+
- Gemfile
|
|
49
|
+
- Rakefile
|
|
50
|
+
- inspector_gadget.gemspec
|
|
51
|
+
- lib/inspector_gadget.rb
|
|
52
|
+
- lib/inspector_gadget/version.rb
|
|
53
|
+
has_rdoc: true
|
|
54
|
+
homepage: http://rubygems.org/gems/inspector_gadget
|
|
55
|
+
licenses: []
|
|
56
|
+
|
|
57
|
+
post_install_message:
|
|
58
|
+
rdoc_options: []
|
|
59
|
+
|
|
60
|
+
require_paths:
|
|
61
|
+
- lib
|
|
62
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
63
|
+
none: false
|
|
64
|
+
requirements:
|
|
65
|
+
- - ">="
|
|
66
|
+
- !ruby/object:Gem::Version
|
|
67
|
+
hash: 3
|
|
68
|
+
segments:
|
|
69
|
+
- 0
|
|
70
|
+
version: "0"
|
|
71
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
72
|
+
none: false
|
|
73
|
+
requirements:
|
|
74
|
+
- - ">="
|
|
75
|
+
- !ruby/object:Gem::Version
|
|
76
|
+
hash: 23
|
|
77
|
+
segments:
|
|
78
|
+
- 1
|
|
79
|
+
- 3
|
|
80
|
+
- 6
|
|
81
|
+
version: 1.3.6
|
|
82
|
+
requirements: []
|
|
83
|
+
|
|
84
|
+
rubyforge_project: inspector_gadget
|
|
85
|
+
rubygems_version: 1.3.7
|
|
86
|
+
signing_key:
|
|
87
|
+
specification_version: 3
|
|
88
|
+
summary: Inspect any object's methods by including the module
|
|
89
|
+
test_files: []
|
|
90
|
+
|