Sha256: 128c904b16ededd158c13b3aa0deb0dfbfae4f948dc16936b977ce445e72782f

Contents?: true

Size: 832 Bytes

Versions: 33

Compression:

Stored size: 832 Bytes

Contents

module CanTango
  class Configuration
    class Autoload
      include Singleton

      def clear!
        @models = :on
        @permits = :on
      end

      [:models, :permits].each do |name|
        # def permission state = nil
        #   raise ArgumentError unless [:on, :off].include? state
        #   @permission = state
        # end
        class_eval %{
          def #{name} state = nil
            return #{name}? if !state
            raise ArgumentError, "Must be :on or :off" unless [:on, :off].include? state
            @#{name} = state
          end
        }
         # def permits?
        #   @permits ||= :on
        #   @permits == :on
        # end
        class_eval %{
          def #{name}?
            @#{name} ||= :on
            @#{name} == :on
          end
        }
      end
    end
  end
end


Version data entries

33 entries across 33 versions & 2 rubygems

Version Path
cantango-config-0.1.9.2 lib/cantango/configuration/autoload.rb
cantango-config-0.1.8.1 lib/cantango/configuration/autoload.rb
cantango-config-0.1.8 lib/cantango/configuration/autoload.rb
cantango-config-0.1.7 lib/cantango/configuration/autoload.rb
cantango-config-0.1.6 lib/cantango/configuration/autoload.rb
cantango-config-0.1.5 lib/cantango/configuration/autoload.rb
cantango-config-0.1.4 lib/cantango/configuration/autoload.rb
cantango-config-0.1.3 lib/cantango/configuration/autoload.rb
cantango-config-0.1.2 lib/cantango/configuration/autoload.rb
cantango-config-0.1.1 lib/cantango/configuration/autoload.rb
cantango-config-0.1.0 lib/cantango/configuration/autoload.rb
cantango-0.9.4.7 lib/cantango/configuration/autoload.rb
cantango-0.9.4.6 lib/cantango/configuration/autoload.rb
cantango-0.9.4.5 lib/cantango/configuration/autoload.rb
cantango-0.9.4.3 lib/cantango/configuration/autoload.rb
cantango-0.9.4.2 lib/cantango/configuration/autoload.rb
cantango-0.9.4.1 lib/cantango/configuration/autoload.rb
cantango-0.9.4 lib/cantango/configuration/autoload.rb
cantango-0.9.3.2 lib/cantango/configuration/autoload.rb
cantango-0.8.9.5 lib/cantango/configuration/autoload.rb