Class: HyperAdmin::Resource

Inherits:
Object
  • Object
show all
Defined in:
lib/hyper_admin/resource.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(resource_class, config) ⇒ Resource

Returns a new instance of Resource.



5
6
7
8
# File 'lib/hyper_admin/resource.rb', line 5

def initialize(resource_class, config)
  @resource_class = resource_class
  @config = config
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



3
4
5
# File 'lib/hyper_admin/resource.rb', line 3

def config
  @config
end

#resource_classObject (readonly)

Returns the value of attribute resource_class.



3
4
5
# File 'lib/hyper_admin/resource.rb', line 3

def resource_class
  @resource_class
end

Instance Method Details

#controller_nameObject



14
15
16
# File 'lib/hyper_admin/resource.rb', line 14

def controller_name
  "#{resource_name.plural.camelize}Controller"
end

#form_configObject



26
27
28
# File 'lib/hyper_admin/resource.rb', line 26

def form_config
  @config[:form_config] if @config
end

#index_configObject



22
23
24
# File 'lib/hyper_admin/resource.rb', line 22

def index_config
  @config[:index_config] if @config
end

#resource_nameObject



10
11
12
# File 'lib/hyper_admin/resource.rb', line 10

def resource_name
  @resource_class.model_name
end

#show_configObject



18
19
20
# File 'lib/hyper_admin/resource.rb', line 18

def show_config
  @config[:show_config] if @config
end