module Zetto::Config::Params

Constants

CRYPTO_ALGORITHMS

Attributes

check_ip[RW]
log[RW]
redis_connect[R]
session_length[R]
session_time_min[R]
session_time_restart_min[R]
user_class_name[R]
user_class_password[R]
user_class_password_crypto[R]
user_class_password_length_larger[R]

Public Class Methods

attr_writer_with_type(type, *args) click to toggle source
# File lib/zetto/config/params.rb, line 25
def self.attr_writer_with_type(type, *args)
  args.each do |arg|
    self.send(:define_method, "#{arg}=".intern) do |value|
      unless value.class.to_s == type
        raise ArgumentError.new(I18n.t('exseptions.not_specified_type', arg: arg, type: type, class_name: value.class.to_s))
      end
      instance_variable_set("@#{arg}", value)
    end
  end
end
set_params() { |self| ... } click to toggle source
# File lib/zetto/config/params.rb, line 44
def set_params
  yield self
end
user_class(class_str) click to toggle source
# File lib/zetto/config/params.rb, line 60
def user_class(class_str)
  begin
    unless @user_classes.include?(class_str)
      raise ArgumentError.new(I18n.t('exseptions.unknown_target_class', class_name: class_str.to_s ))
    end
    class_str.constantize
  rescue Exception => e
    puts e.message
    nil
  end
end
user_class_password_crypto=(value) click to toggle source
# File lib/zetto/config/params.rb, line 48
def user_class_password_crypto=(value)
  value = value.to_s.upcase
  unless self::CRYPTO_ALGORITHMS.include?(value)
    raise ArgumentError.new(I18n.t('exseptions.unknown_algorithm', algorithm: value.to_s ))
  end
  @user_class_password_crypto = value
end
user_classes=(arr) click to toggle source
# File lib/zetto/config/params.rb, line 56
def user_classes=(arr)
  @user_classes = arr.map{ |class_name| class_name.to_s.capitalize  }
end