Class: Vop::EntityLoader
- Inherits:
-
Object
- Object
- Vop::EntityLoader
- Defined in:
- lib/vop/parts/entity_loader.rb
Instance Method Summary collapse
-
#initialize(plugin) ⇒ EntityLoader
constructor
A new instance of EntityLoader.
- #prepare(name) ⇒ Object
- #read_sources(named_sources) ⇒ Object
Constructor Details
#initialize(plugin) ⇒ EntityLoader
Returns a new instance of EntityLoader.
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/vop/parts/entity_loader.rb', line 8 def initialize(plugin) @plugin = plugin @op = plugin.op @loaded = [] @plugin.inject_helpers(self) extend EntitySyntax end |
Instance Method Details
#prepare(name) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/vop/parts/entity_loader.rb', line 19 def prepare(name) @entity = EntityDefinition.new(@plugin, name) @command = @entity @loaded << @entity @entity end |
#read_sources(named_sources) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/vop/parts/entity_loader.rb', line 26 def read_sources(named_sources) named_sources.each do |name, source| prepare(name) begin self.instance_eval(source[:code], source[:file_name]) rescue SyntaxError => detail raise Errors::EntityLoadError.new("problem loading entity #{name} : #{detail.}") end end @loaded end |