Sha256: 51cae7ff1ad23e6d658c107ca692b93fc19a60f146975d64963691b1e52b263a

Contents?: true

Size: 612 Bytes

Versions: 5

Compression:

Stored size: 612 Bytes

Contents

module Puffer
  module Controller
    class Config

      attr_accessor :config
      cattr_accessor :default_config
      @@default_config = {}

      def initialize
        @config = {}
      end

      def self.option name, default
        @@default_config[name.to_sym] = default
        class_eval <<-EOS
          def #{name} value = nil
            value.nil? ? (@config.key?(:#{name}) ? @config[:#{name}] : self.class.default_config[:#{name}]) : @config[:#{name}] = value
          end
        EOS
      end

      option :destroy, true
      option :model, nil
      option :scope, {}

    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
puffer-0.0.5 lib/puffer/controller/config.rb
puffer-0.0.4 lib/puffer/controller/config.rb
puffer-0.0.3 lib/puffer/controller/config.rb
puffer-0.0.2 lib/puffer/controller/config.rb
puffer-0.0.1 lib/puffer/controller/config.rb