lib/spiderfw/widget/widget_plugin.rb in spiderfw-0.5.13 vs lib/spiderfw/widget/widget_plugin.rb in spiderfw-0.5.14
- old
+ new
@@ -7,28 +7,39 @@
mod.module_eval{ include Annotations }
end
module ModuleMethods
- def self.plugin_name
+ def plugin_name
@plugin_name
end
def plugin_for(widget, plugin_name)
@plugin_name = plugin_name
widget.add_plugin(plugin_name, self)
@path = File.dirname(File.expand_path(caller[0].split(':')[0]))
end
+ def overrides_path
+ @path+'/'+Inflector.underscore(self.to_s.split('::')[-1])+'.shtml'
+ end
+
def get_overrides
overrides = []
- path = @path+'/'+Inflector.underscore(self.to_s.split('::')[-1])+'.shtml'
+ path = overrides_path
doc = open(path){ |f| Hpricot.XML(f) }
doc.root.each_child do |child|
next unless child.is_a?(Hpricot::Elem)
overrides << child
end
return overrides
+ end
+
+ def get_assets
+ path = overrides_path
+ return open(path){ |f| Hpricot.XML(f) }.root.children_of_type('tpl:asset').map{ |el|
+ Spider::Template.parse_asset_element(el)
+ }
end
end
end
\ No newline at end of file