module Obfuscate

Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Constants

VERSION

Attributes

config[RW]

Public Class Methods

clarify(text, options = {} ) click to toggle source

Clarify obfuscated text. Depends on Obfuscate.setup to be called first

@param [String] text to be clarified @param [Hash] options overrides how clarify should be handled @return [String]

# File lib/obfuscate.rb, line 39
def clarify(text, options = {} )
  cryptor( options ).clarify( text )
end
cryptor(options = {} ) click to toggle source

Create instance of Obfuscate::Crypt. Depends on Obfuscate.setup to be called first

@param [Hash] overrides how instance should be created @return [Obfuscate::Crypt]

# File lib/obfuscate.rb, line 47
def cryptor(options = {} )
  Obfuscate::Crypt.new( @config.apply( options ) )
end
obfuscate(text, options = {} ) click to toggle source

Obfuscate text. Depends on Obfuscate.setup to be called first

@param [String] text to be obfuscated @param [Hash] options overrides how obfuscation should be handled @return [String]

# File lib/obfuscate.rb, line 30
def obfuscate(text, options = {} )
  cryptor( options ).obfuscate( text )
end
setup(options ={}, &blk) click to toggle source

Setup Obfuscate passing in a hash and/or block

@param [Hash] options of configurations @option options [Symbol] :salt A Model specific salt @option options [Symbol] :encode Enable Base64 and URL encoding for this Model. Enabled by default. @option options [Symbol] :remove_trailing_equal When in :block mode, removes the trailing = from the

obfuscated text.

@param [block] blk of configuration, has precedence over options Hash. @return [Obfuscate::Config]

# File lib/obfuscate.rb, line 60
def setup(options ={}, &blk)
  @config = @config.apply(options, &blk)
end