Class: Vop::FilterLoader
- Inherits:
-
Object
- Object
- Vop::FilterLoader
- Defined in:
- lib/vop/parts/filter_loader.rb
Instance Method Summary collapse
-
#initialize(plugin) ⇒ FilterLoader
constructor
A new instance of FilterLoader.
- #new_filter(name) ⇒ Object
- #read_sources(named_sources) ⇒ Object
Constructor Details
#initialize(plugin) ⇒ FilterLoader
Returns a new instance of FilterLoader.
8 9 10 11 12 13 14 15 16 |
# File 'lib/vop/parts/filter_loader.rb', line 8 def initialize(plugin) @plugin = plugin @op = @plugin.op @filters = [] @plugin.inject_helpers(self) extend FilterSyntax end |
Instance Method Details
#new_filter(name) ⇒ Object
18 19 20 21 22 |
# File 'lib/vop/parts/filter_loader.rb', line 18 def new_filter(name) @filter = Filter.new(@plugin, name) @filters << @filter @filter end |
#read_sources(named_sources) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/vop/parts/filter_loader.rb', line 24 def read_sources(named_sources) # reads a hash of <name> => <source string> named_sources.each do |name, source| new_filter(name) begin self.instance_eval(source[:code], source[:file_name]) rescue => detail raise Errors::LoadError.new("problem loading filter #{name}", detail) end end @filters end |