3 changed files with 17 additions and 31 deletions
@ -1,12 +0,0 @@ |
|||||||
require 'rainbow/refinement' |
|
||||||
|
|
||||||
module Squib::ErrorContext |
|
||||||
using Rainbow # we can colorize strings now! |
|
||||||
|
|
||||||
# When we throw an error, we want to be able to find and report: |
|
||||||
# (a) the DSL method we called, e.g. 'background' |
|
||||||
# (b) the line number from the user's source file |
|
||||||
def error_context |
|
||||||
"in Squib DSL method #{dsl_method.to_s.aliceblue} from #{user_loc}" |
|
||||||
end |
|
||||||
end |
|
||||||
@ -1,14 +1,13 @@ |
|||||||
require_relative 'error_context' |
|
||||||
require 'rainbow/refinement' |
require 'rainbow/refinement' |
||||||
|
|
||||||
module Squib::WarnUnexpectedParam |
module Squib::WarnUnexpectedParams |
||||||
using Rainbow # we can colorize strings now! |
using Rainbow # we can colorize strings now! |
||||||
def warn_unexpected_params(opts) |
|
||||||
|
def warn_if_unexpected(opts, uplevel: 5) |
||||||
unexpected = opts.keys - accepted_params |
unexpected = opts.keys - accepted_params |
||||||
unexpected.each do |key| |
unexpected.each do |key| |
||||||
Squib.logger.warn do |
warn "Unexpected parameter '#{key.to_s.yellow}:' to #{dsl_method.to_s.cyan}(), ignoring...", |
||||||
"Unexpected option '#{key.to_s.yellow}' #{@error_cxt} ...ignoring" |
uplevel: uplevel |
||||||
end |
|
||||||
end |
end |
||||||
end |
end |
||||||
end |
end |
||||||
|
|||||||
Loading…
Reference in new issue