Sha256: de7cd36abd5c2b36b984e5521686fed9eba073aa5d921862c8e5b438216bd50a

Contents?: true

Size: 487 Bytes

Versions: 1

Compression:

Stored size: 487 Bytes

Contents

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

    attr_accessor(*VALID_OPTIONS)

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

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

    def reset
      @stretching = 12
      @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.4.0 lib/passwd/config.rb