Class: PagesCore::Plugin
- Inherits:
-
Object
- Object
- PagesCore::Plugin
- Defined in:
- lib/pages_core/plugin.rb
Direct Known Subclasses
Class Attribute Summary collapse
-
.called_from ⇒ Object
Returns the value of attribute called_from.
-
.paths ⇒ Object
Returns the value of attribute paths.
Class Method Summary collapse
- .admin_menu_item(label, path, group = :custom, options = {}) ⇒ Object
- .inherited(plugin) ⇒ Object
- .plugins ⇒ Object
Instance Method Summary collapse
Class Attribute Details
.called_from ⇒ Object
Returns the value of attribute called_from.
12 13 14 |
# File 'lib/pages_core/plugin.rb', line 12 def called_from @called_from end |
.paths ⇒ Object
Returns the value of attribute paths.
12 13 14 |
# File 'lib/pages_core/plugin.rb', line 12 def paths @paths end |
Class Method Details
.admin_menu_item(label, path, group = :custom, options = {}) ⇒ Object
29 30 31 |
# File 'lib/pages_core/plugin.rb', line 29 def (label, path, group = :custom, = {}) PagesCore::AdminMenuItem.register(label, path, group, ) end |
.inherited(plugin) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/pages_core/plugin.rb', line 14 def inherited(plugin) plugin.paths ||= default_paths plugin.called_from = begin # Remove the line number from backtraces making sure we # don't leave anything behind call_stack = caller.map { |p| p.sub(/:\d+.*/, "") } File.dirname( call_stack.detect do |p| p !~ %r{railties[\w.-]*/lib/rails|rack[\w.-]*/lib/rack} end ) end super end |
Instance Method Details
#paths ⇒ Object
52 53 54 |
# File 'lib/pages_core/plugin.rb', line 52 def paths self.class.paths end |
#root ⇒ Object
48 49 50 |
# File 'lib/pages_core/plugin.rb', line 48 def root @root ||= find_root_with_subfolder("app") end |