Module: BootstrapAdmin::ControllerHelpers

Defined in:
lib/bootstrap_admin/controller_helpers.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args) ⇒ Object

Eases the access to config properties via bootstrap_admin_config



60
61
62
63
64
65
66
# File 'lib/bootstrap_admin/controller_helpers.rb', line 60

def method_missing method, *args
  if bootstrap_admin_config.respond_to? method
    bootstrap_admin_config.send method, *args
  else
    super method, *args
  end
end

Class Method Details

.included(base) ⇒ Object



75
76
77
# File 'lib/bootstrap_admin/controller_helpers.rb', line 75

def self.included base
  base.extend ClassMethods
end

Instance Method Details

#bootstrap_admin_configObject

Helper method - provides access to the controller config on the views



54
55
56
# File 'lib/bootstrap_admin/controller_helpers.rb', line 54

def bootstrap_admin_config
  self.class.instance_variable_get "@bootstrap_admin_config"
end

#respond_to?(method, include_private = false) ⇒ Boolean

self responds_to bootstrap_admin_config methods via method_missing!

Returns:

  • (Boolean)


69
70
71
72
# File 'lib/bootstrap_admin/controller_helpers.rb', line 69

def respond_to? method, include_private = false
  true if bootstrap_admin_config.respond_to? method
  super method, include_private
end