Sha256: e6ad13a0c0e8d5b5e20529705045e6adcb8db23799e023e5ff9f5a5b65d13408

Contents?: true

Size: 864 Bytes

Versions: 7

Compression:

Stored size: 864 Bytes

Contents

module Puffer
  module Controller
    module Mutate

      def self.included base
        base.class_eval do
          extend ClassMethods
          include InstanceMethods

          layout 'puffer'
          helper :puffer
          helper_method :puffer?, :namespace
        end
      end

      module InstanceMethods

        def puffer?
          self.class.puffer?
        end

        def namespace
          self.class.namespace
        end

      end

      module ClassMethods

        def puffer?
          true
        end

        def namespace
          to_s.underscore.split('/').first
        end

        def model_name
          @model_name ||= (configuration.model_name || controller_name.singularize).to_s
        end

        def model
          @model ||= model_name.camelize.constantize rescue nil
        end

      end

    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
puffer-0.0.26 lib/puffer/controller/mutate.rb
puffer-0.0.25 lib/puffer/controller/mutate.rb
puffer-0.0.24 lib/puffer/controller/mutate.rb
puffer-0.0.23 lib/puffer/controller/mutate.rb
puffer-0.0.22 lib/puffer/controller/mutate.rb
puffer-0.0.21 lib/puffer/controller/mutate.rb
puffer-0.0.20 lib/puffer/controller/mutate.rb