Module: Spider::WidgetPlugin::ModuleMethods
- Defined in:
- lib/spiderfw/widget/widget_plugin.rb
Instance Method Summary (collapse)
- - (Boolean) controller_action?(method)
- - (Object) controller_actions(*methods)
- - (Object) get_assets
- - (Object) get_overrides
- - (Object) overrides_path
- - (Object) plugin_for(widget, plugin_name)
- - (Object) plugin_name
Instance Method Details
- (Boolean) controller_action?(method)
54 55 56 |
# File 'lib/spiderfw/widget/widget_plugin.rb', line 54 def controller_action?(method) @controller_actions && @controller_actions.include?(method) end |
- (Object) controller_actions(*methods)
46 47 48 49 50 51 52 |
# File 'lib/spiderfw/widget/widget_plugin.rb', line 46 def controller_actions(*methods) if (methods.length > 0) @controller_actions ||= [] @controller_actions += methods end @controller_actions end |
- (Object) get_assets
39 40 41 42 43 44 |
# File 'lib/spiderfw/widget/widget_plugin.rb', line 39 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 |
- (Object) get_overrides
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/spiderfw/widget/widget_plugin.rb', line 28 def get_overrides overrides = [] 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 |
- (Object) overrides_path
24 25 26 |
# File 'lib/spiderfw/widget/widget_plugin.rb', line 24 def overrides_path @path+'/'+Inflector.underscore(self.to_s.split('::')[-1])+'.shtml' end |
- (Object) plugin_for(widget, plugin_name)
18 19 20 21 22 |
# File 'lib/spiderfw/widget/widget_plugin.rb', line 18 def plugin_for(, plugin_name) @plugin_name = plugin_name .add_plugin(plugin_name, self) @path = File.dirname(File.(caller[0].split(':')[0])) end |
- (Object) plugin_name
14 15 16 |
# File 'lib/spiderfw/widget/widget_plugin.rb', line 14 def plugin_name @plugin_name end |