NAME
DDG::Block::Words - Block implementation to handle words based plugins
VERSION
version 1018
DESCRIPTION
The BUILD function is used to build a hash which maps trigger positions (start, any, end) to trigger words to trigger phrase length to plugins.
Eg. Given triggers:
START: "khan", "khan academy";
ANY  : "forecast", "weather forecast";
END  : "video", "youtube videos";
This would produce the following hash:
_words_plugins = {
start => {
	'khan' => {
		1 => [ DDG::Spice::KhanAcademy ],
		2 => {
			'khan academy' => [ DDG::Spice::KhanAcademy ]
		}
	}
},
any => {
	'forecast' => {
		1 => [ DDG::Spice::Forecast, DDG::Spice::Foo ]
	},
	'weather' => {
		2 => {
			'weather forecast' => [ DDG::Spice::Forecast ]
		}
	}
},
end => {
	'video' => {
		1 => [ DDG::Spice::Video ]
	},
	'videos' => {
		2 => {
			'youtube videos' => [ DDG::Spice::Video ]
		}
	}
}
}
ATTRIBUTES
words_plugins
This private attribute is a cache for grouping the plugins into start, end and any based plugins.
METHODS
request
empty_trigger
Overloading this method from DDG::Block assures that we dont allow any plugin which as no triggers. Words plugins are all triggered via keywords against a hash, which means there is no order relevance, which makes a triggerless plugin just totally unclear, if it now needs to get started before the hash compare or after (or not).
AUTHOR
DuckDuckGo <open@duckduckgo.com>
COPYRIGHT AND LICENSE
This software is Copyright (c) 2013 by DuckDuckGo, Inc. https://duckduckgo.com/.
This is free software, licensed under:
The Apache License, Version 2.0, January 2004