Sha256: 8232f9e4b40ca44ccda91fb11a1338956133068a55adf20603ecb6aac0a7ca20

Contents?: true

Size: 616 Bytes

Versions: 4

Compression:

Stored size: 616 Bytes

Contents

# -*- coding: utf-8 -*-
# vim:ft=ruby:enc=utf-8

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

4 entries across 4 versions & 1 rubygems

Version Path
to_pass-0.5.2 lib/to_pass/base.rb
to_pass-0.5.0 lib/to_pass/base.rb
to_pass-0.4.0 lib/to_pass/base.rb
to_pass-0.2.4 lib/to_pass/base.rb