Class: Cmtool::Menu::ElementBase

Inherits:
Object
  • Object
show all
Defined in:
lib/cmtool/menu.rb

Overview

Base class for elements in the menu. All elements like Groups/ResourceLinks should inherit from this class

Direct Known Subclasses

Divider, EngineLink, Group, ResourceLink

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ ElementBase

Returns a new instance of ElementBase.



34
35
36
# File 'lib/cmtool/menu.rb', line 34

def initialize(*args)
  @options = args.extract_options!
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(*args) ⇒ Object



46
47
48
49
50
# File 'lib/cmtool/menu.rb', line 46

def method_missing(*args)
  return true if self.class.name.sub(/.*::/, '').underscore.concat("?") == args.first.to_s
  return false if args.first.to_s.last == '?'
  @register.send(*args)
end

Instance Method Details

#controller_nameObject



40
41
42
# File 'lib/cmtool/menu.rb', line 40

def controller_name
  ''
end

#controller_namesObject



37
38
39
# File 'lib/cmtool/menu.rb', line 37

def controller_names
  []
end

#engine_link?Boolean

Returns:

  • (Boolean)


52
53
54
# File 'lib/cmtool/menu.rb', line 52

def engine_link?
  false
end

#optionsObject



43
44
45
# File 'lib/cmtool/menu.rb', line 43

def options
  @options ||= {}
end

#resource_link?Boolean

Returns:

  • (Boolean)


56
57
58
# File 'lib/cmtool/menu.rb', line 56

def resource_link?
  false
end