Class: ControllerHelper::ClassMethods::Partials

Inherits:
Object
  • Object
show all
Defined in:
app/helpers/kit/controller_helper.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(controller_class) ⇒ Partials

Returns a new instance of Partials.



51
52
53
# File 'app/helpers/kit/controller_helper.rb', line 51

def initialize controller_class
  @controller_class = controller_class
end

Instance Attribute Details

#controller_classObject (readonly)

Returns the value of attribute controller_class.



49
50
51
# File 'app/helpers/kit/controller_helper.rb', line 49

def controller_class
  @controller_class
end

Instance Method Details

#hide(name, options = {}) ⇒ Object



61
62
63
64
65
# File 'app/helpers/kit/controller_helper.rb', line 61

def hide name, options = {}
  controller_class.send :before, options do |controller|
    controller.send(:_partials).delete name
  end
end

#show(name, options = {}) ⇒ Object



55
56
57
58
59
# File 'app/helpers/kit/controller_helper.rb', line 55

def show name, options = {}
  controller_class.send :before, options do |controller|
    controller.send(:_partials)[name] = true
  end
end