Class: Magick::AdminUI::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/magick/admin_ui.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



22
23
24
25
26
27
28
# 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 }
end

Instance Attribute Details

#available_rolesObject

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_tagsObject

Returns the value of attribute available_tags.



20
21
22
# File 'lib/magick/admin_ui.rb', line 20

def available_tags
  @available_tags
end

#brand_nameObject

Returns the value of attribute brand_name.



20
21
22
# File 'lib/magick/admin_ui.rb', line 20

def brand_name
  @brand_name
end

#require_roleObject

Returns the value of attribute require_role.



20
21
22
# File 'lib/magick/admin_ui.rb', line 20

def require_role
  @require_role
end

#themeObject

Returns the value of attribute theme.



20
21
22
# File 'lib/magick/admin_ui.rb', line 20

def theme
  @theme
end

Instance Method Details

#tagsObject

Get available tags, calling lambda if needed



31
32
33
34
35
# File 'lib/magick/admin_ui.rb', line 31

def tags
  return [] if @available_tags.nil?
  return @available_tags.call if @available_tags.respond_to?(:call)
  Array(@available_tags)
end