Class: Refinery::Menus::Linkable

Inherits:
Object
  • Object
show all
Defined in:
lib/refinery/menus/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ Linkable

Returns a new instance of Linkable.



20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/refinery/menus/configuration.rb', line 20

def initialize(params)
  if params.is_a? Hash
    @class_name = params[:class_name]
    @name_attribute = params[:name_attribute]
  elsif params.is_a? String
    @class_name = params
    @name_attribute = :name
  else
    raise 'Unknown link initialize params'
  end
  @klass = class_name.constantize
  @human_class_name = @klass.model_name.human
end

Instance Attribute Details

#class_nameObject

Returns the value of attribute class_name.



18
19
20
# File 'lib/refinery/menus/configuration.rb', line 18

def class_name
  @class_name
end

#human_class_nameObject

Returns the value of attribute human_class_name.



18
19
20
# File 'lib/refinery/menus/configuration.rb', line 18

def human_class_name
  @human_class_name
end

#klassObject

Returns the value of attribute klass.



18
19
20
# File 'lib/refinery/menus/configuration.rb', line 18

def klass
  @klass
end

#name_attributeObject

Returns the value of attribute name_attribute.



18
19
20
# File 'lib/refinery/menus/configuration.rb', line 18

def name_attribute
  @name_attribute
end