Module: WhyQuery
- Defined in:
- lib/why_query.rb,
lib/why_query/config.rb,
lib/why_query/version.rb,
lib/why_query/railtile.rb
Defined Under Namespace
Constant Summary collapse
- VERSION =
"0.1.0"
Class Attribute Summary collapse
-
.config ⇒ Object
Returns the value of attribute config.
Class Method Summary collapse
Class Attribute Details
.config ⇒ Object
Returns the value of attribute config.
12 13 14 |
# File 'lib/why_query.rb', line 12 def config @config end |
Class Method Details
.configure {|config| ... } ⇒ Object
14 15 16 |
# File 'lib/why_query.rb', line 14 def configure yield(config) end |
.enabled? ⇒ Boolean
22 23 24 |
# File 'lib/why_query.rb', line 22 def enabled? config.enabled end |
.log_origin ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/why_query.rb', line 26 def log_origin stack = caller_locations(3, 10) location = stack.find do |loc| path = loc.path path.start_with?(Rails.root.to_s) && !path.include?("/gems/") end if config.app_only location ||= stack[0] # fallback to any top stack if location config.logger.call("↳ Called from: #{location.path.sub(Rails.root.to_s + "/", "")}:#{location.lineno}") end end |