Sha256: 3753620dece583dca8b0bd8c47aca67919acefca929e99adef7a01d0e9c18ff7

Contents?: true

Size: 567 Bytes

Versions: 2

Compression:

Stored size: 567 Bytes

Contents

module ToPass
  # ToPass::Base is mostly a facade for the library.
  #
  # Given a string and a algorithm identifier, the right rules
  # are loaded and applied to the string. With a simple "to_s",
  # you can get the final password
  class Base
    # transform a string according to a certain algorithm
    def initialize( string, algorithm )
      rules = AlgorithmReader.load(algorithm)
      converter = Converter.new( rules )
      @password = converter.convert(string)
    end

    # return the generated password
    def to_s
      @password
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
to_pass-0.2.3 lib/to_pass/base.rb
to_pass-0.2.2 lib/to_pass/base.rb