Class: HyperAdmin::Resource
- Inherits:
-
Object
- Object
- HyperAdmin::Resource
- Defined in:
- lib/hyper_admin/resource.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#resource_class ⇒ Object
readonly
Returns the value of attribute resource_class.
Instance Method Summary collapse
- #controller_name ⇒ Object
- #form_config ⇒ Object
- #index_config ⇒ Object
-
#initialize(resource_class, config) ⇒ Resource
constructor
A new instance of Resource.
- #resource_name ⇒ Object
- #show_config ⇒ Object
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
#config ⇒ Object (readonly)
Returns the value of attribute config
3 4 5 |
# File 'lib/hyper_admin/resource.rb', line 3 def config @config end |
#resource_class ⇒ Object (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_name ⇒ Object
14 15 16 |
# File 'lib/hyper_admin/resource.rb', line 14 def controller_name "#{resource_name.plural.camelize}Controller" end |
#form_config ⇒ Object
26 27 28 |
# File 'lib/hyper_admin/resource.rb', line 26 def form_config @config[:form_config] if @config end |
#index_config ⇒ Object
22 23 24 |
# File 'lib/hyper_admin/resource.rb', line 22 def index_config @config[:index_config] if @config end |
#resource_name ⇒ Object
10 11 12 |
# File 'lib/hyper_admin/resource.rb', line 10 def resource_name @resource_class.model_name end |
#show_config ⇒ Object
18 19 20 |
# File 'lib/hyper_admin/resource.rb', line 18 def show_config @config[:show_config] if @config end |