Sha256: 0e9175cdb50428dd102b6b2be739590a8a37cb82f21ac62c8c6f154003870e38

Contents?: true

Size: 862 Bytes

Versions: 13

Compression:

Stored size: 862 Bytes

Contents

module PushType
  module ApplicationControllerMethods
    extend ActiveSupport::Concern

    FILTERS = [
      :before_node_load_filters, :before_node_action_filters, :after_node_action_filters
    ]

    included do
      class_attribute *FILTERS
      helper PushType::MediaUrlHelper
      helper PushType::NodeUrlHelper
    end

    protected

    def permalink_path
      params[:permalink].split('/')
    end

    private

    FILTERS.each do |filter|
      define_method(filter) { self.class.send(filter) }
    end

    module ClassMethods
      FILTERS.each do |filter|
        method_name = filter.to_s.gsub(/_filters$/, '')

        define_method method_name do |*args, &block|
          args.push block if block
          filters = ( self.send(filter) || [] ) << args
          self.send "#{ filter }=", filters
        end
      end
    end

  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
push_type_core-0.12.1 app/controllers/concerns/push_type/application_controller_methods.rb
push_type_core-0.12.0 app/controllers/concerns/push_type/application_controller_methods.rb
push_type_core-0.12.0.beta.1 app/controllers/concerns/push_type/application_controller_methods.rb
push_type_core-0.11.2 app/controllers/concerns/push_type/application_controller_methods.rb
push_type_core-0.11.1 app/controllers/concerns/push_type/application_controller_methods.rb
push_type_core-0.11.0.beta.2 app/controllers/concerns/push_type/application_controller_methods.rb
push_type_core-0.11.0.beta.1 app/controllers/concerns/push_type/application_controller_methods.rb
push_type_core-0.10.4 app/controllers/concerns/push_type/application_controller_methods.rb
push_type_core-0.10.3 app/controllers/concerns/push_type/application_controller_methods.rb
push_type_core-0.10.2 app/controllers/concerns/push_type/application_controller_methods.rb
push_type_core-0.10.1 app/controllers/concerns/push_type/application_controller_methods.rb
push_type_core-0.10.0 app/controllers/concerns/push_type/application_controller_methods.rb
push_type_core-0.10.0.beta.5 app/controllers/concerns/push_type/application_controller_methods.rb