Sha256: b3a2d69a9230b95f32ac998f25a8f0104285b302d6d838b3368c8934a581c53b

Contents?: true

Size: 710 Bytes

Versions: 3

Compression:

Stored size: 710 Bytes

Contents

module Happy
  class Controller
    module Configurable
      extend ActiveSupport::Concern

      # Return a hash containing this controller instance's settings.
      #
      def settings
        @settings ||= self.class.settings.dup
      end

      # Change a setting on this controller instance.
      #
      def set(k, v)
        settings[k.to_sym] = v
      end

      module ClassMethods
        # Return a hash containing this controller class' default settings.
        #
        def settings
          @settings ||= {}
        end

        # Change a default setting on this controller class.
        #
        def set(k, v)
          settings[k.to_sym] = v
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
happy-0.1.0 lib/happy/controller/configurable.rb
happy-0.1.0.pre28 lib/happy/controller/configurable.rb
happy-0.1.0.pre27 lib/happy/controller/configurable.rb