Skip to content

Commit

Permalink
lib/lingo/attendee.rb: Include config file in invalid options warning (
Browse files Browse the repository at this point in the history
  • Loading branch information
blackwinter committed Feb 6, 2015
1 parent c2f31aa commit 30c9b2b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 3 additions & 2 deletions lib/lingo/attendee.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Lingo -- A full-featured automatic indexing system #
# #
# Copyright (C) 2005-2007 John Vorhauer #
# Copyright (C) 2007-2012 John Vorhauer, Jens Wille #
# Copyright (C) 2007-2015 John Vorhauer, Jens Wille #
# #
# Lingo is free software; you can redistribute it and/or modify it under the #
# terms of the GNU Affero General Public License as published by the Free #
Expand Down Expand Up @@ -85,7 +85,8 @@ def initialize(config, lingo)
unless (invalid_keys = config.keys - @valid_keys).empty?
warn(
"CONFIGURATION NOTICE: #{self.class.name.sub(/\ALingo::/, '')}" <<
" options invalid or obsolete: #{invalid_keys.sort.join(', ')}"
" options invalid or obsolete: #{invalid_keys.sort.join(', ')}" <<
" (in #{lingo.config.config_file})"
)
end
end
Expand Down
6 changes: 5 additions & 1 deletion lib/lingo/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Lingo -- A full-featured automatic indexing system #
# #
# Copyright (C) 2005-2007 John Vorhauer #
# Copyright (C) 2007-2014 John Vorhauer, Jens Wille #
# Copyright (C) 2007-2015 John Vorhauer, Jens Wille #
# #
# Lingo is free software; you can redistribute it and/or modify it under the #
# terms of the GNU Affero General Public License as published by the Free #
Expand Down Expand Up @@ -58,6 +58,8 @@ def initialize(*args)
end
end

attr_reader :language_file, :config_file

def to_h
@opts
end
Expand Down Expand Up @@ -129,6 +131,8 @@ def nodes_to_key(nodes)

def load_config(key, type = key.to_sym)
file = Lingo.find(type, @opts[key]) { quit }
instance_variable_set("@#{type}_file", file)

File.open(file, encoding: ENC) { |f| @opts.update(SafeYAML.load(f)) }
rescue Psych::SyntaxError => err
err.message << " (in #{file})"
Expand Down

0 comments on commit 30c9b2b

Please sign in to comment.