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