Class: Magick::AdminUI::Configuration
- Inherits:
-
Object
- Object
- Magick::AdminUI::Configuration
- Defined in:
- lib/magick/admin_ui.rb
Instance Attribute Summary collapse
-
#available_roles ⇒ Object
Returns the value of attribute available_roles.
-
#available_tags ⇒ Object
Returns the value of attribute available_tags.
-
#brand_name ⇒ Object
Returns the value of attribute brand_name.
-
#current_actor ⇒ Object
Returns the value of attribute current_actor.
-
#require_role ⇒ Object
Returns the value of attribute require_role.
-
#theme ⇒ Object
Returns the value of attribute theme.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
-
#tags ⇒ Object
Get available tags, calling lambda if needed.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/magick/admin_ui.rb', line 22 def initialize @theme = :light @brand_name = 'Magick' @require_role = nil @available_roles = [] # Can be populated via DSL: admin_ui { roles ['admin', 'user', 'manager'] } @available_tags = nil # Can be array or lambda: -> { Tag.all } # Lambda receiving the controller, returning who is making the # change; stamped onto audit entries (user_id) and versions # (created_by): -> (controller) { controller.current_user&.id } @current_actor = nil end |
Instance Attribute Details
#available_roles ⇒ Object
Returns the value of attribute available_roles.
20 21 22 |
# File 'lib/magick/admin_ui.rb', line 20 def available_roles @available_roles end |
#available_tags ⇒ Object
Returns the value of attribute available_tags.
20 21 22 |
# File 'lib/magick/admin_ui.rb', line 20 def @available_tags end |
#brand_name ⇒ Object
Returns the value of attribute brand_name.
20 21 22 |
# File 'lib/magick/admin_ui.rb', line 20 def brand_name @brand_name end |
#current_actor ⇒ Object
Returns the value of attribute current_actor.
20 21 22 |
# File 'lib/magick/admin_ui.rb', line 20 def current_actor @current_actor end |
#require_role ⇒ Object
Returns the value of attribute require_role.
20 21 22 |
# File 'lib/magick/admin_ui.rb', line 20 def require_role @require_role end |
#theme ⇒ Object
Returns the value of attribute theme.
20 21 22 |
# File 'lib/magick/admin_ui.rb', line 20 def theme @theme end |
Instance Method Details
#tags ⇒ Object
Get available tags, calling lambda if needed
35 36 37 38 39 |
# File 'lib/magick/admin_ui.rb', line 35 def return [] if @available_tags.nil? return @available_tags.call if @available_tags.respond_to?(:call) Array(@available_tags) end |