Sha256: ea8d47488e842c824ef684ead9cbd945b3f1c6ae8976badc05428d01f3405d80

Contents?: true

Size: 535 Bytes

Versions: 1

Compression:

Stored size: 535 Bytes

Contents

class Passwd
  class Config
    VALID_OPTIONS = [
      :algorithm,
      :stretching,
      :length,
      :characters,
    ].freeze

    attr_accessor *VALID_OPTIONS

    def initialize(options = {})
      reset
      merge(options)
    end

    def merge(options)
      options.keys.each { |key| send("#{key}=", options[key]) }
      self
    end

    def reset
      @algorithm  = :sha512
      @stretching = 100
      @length     = 10
      @characters = [("a".."z"), ("A".."Z"), ("0".."9")].map(&:to_a).flatten
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
passwd-0.3.0 lib/passwd/config.rb