Class: ActiveAdmin::Dashboards::Section
- Inherits:
-
Object
- Object
- ActiveAdmin::Dashboards::Section
- Defined in:
- lib/active_admin/dashboards/section.rb
Constant Summary collapse
- DEFAULT_PRIORITY =
10
Instance Attribute Summary collapse
-
#block ⇒ Object
Returns the value of attribute block.
-
#name ⇒ Object
Returns the value of attribute name.
-
#namespace ⇒ Object
readonly
Returns the value of attribute namespace.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#<=>(other) ⇒ Object
Sort by priority then by name.
- #icon ⇒ Object
-
#initialize(namespace, name, options = {}, &block) ⇒ Section
constructor
A new instance of Section.
- #priority ⇒ Object
Constructor Details
#initialize(namespace, name, options = {}, &block) ⇒ Section
Returns a new instance of Section.
10 11 12 13 14 15 |
# File 'lib/active_admin/dashboards/section.rb', line 10 def initialize(namespace, name, = {}, &block) @namespace = namespace @name = name @options = @block = block end |
Instance Attribute Details
#block ⇒ Object
Returns the value of attribute block.
7 8 9 |
# File 'lib/active_admin/dashboards/section.rb', line 7 def block @block end |
#name ⇒ Object
Returns the value of attribute name.
7 8 9 |
# File 'lib/active_admin/dashboards/section.rb', line 7 def name @name end |
#namespace ⇒ Object (readonly)
Returns the value of attribute namespace.
8 9 10 |
# File 'lib/active_admin/dashboards/section.rb', line 8 def namespace @namespace end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
8 9 10 |
# File 'lib/active_admin/dashboards/section.rb', line 8 def @options end |
Instance Method Details
#<=>(other) ⇒ Object
Sort by priority then by name
26 27 28 29 30 |
# File 'lib/active_admin/dashboards/section.rb', line 26 def <=>(other) result = priority <=> other.priority result = name.to_s <=> other.name.to_s if result == 0 result end |
#icon ⇒ Object
21 22 23 |
# File 'lib/active_admin/dashboards/section.rb', line 21 def icon @options[:icon] end |
#priority ⇒ Object
17 18 19 |
# File 'lib/active_admin/dashboards/section.rb', line 17 def priority @options[:priority] || DEFAULT_PRIORITY end |