Class: Inkcite::Renderer::Redacted
- Defined in:
- lib/inkcite/renderer/redacted.rb
Constant Summary
Constants inherited from Base
Base::BACKGROUND_COLOR, Base::BACKGROUND_GRADIENT, Base::BACKGROUND_IMAGE, Base::BACKGROUND_POSITION, Base::BACKGROUND_REPEAT, Base::BACKGROUND_SIZE, Base::BORDER_BOTTOM, Base::BORDER_COLLAPSE, Base::BORDER_LEFT, Base::BORDER_RADIUS, Base::BORDER_RIGHT, Base::BORDER_SPACING, Base::BORDER_TOP, Base::BOX_SHADOW, Base::DIMENSIONS, Base::DIRECTIONS, Base::FONT_FAMILY, Base::FONT_SIZE, Base::FONT_WEIGHT, Base::LETTER_SPACING, Base::LINE_HEIGHT, Base::LINK_COLOR, Base::MARGIN, Base::MARGIN_BOTTOM, Base::MARGIN_LEFT, Base::MARGIN_RIGHT, Base::MARGIN_TOP, Base::MAX_WIDTH, Base::NONE, Base::PADDING_X, Base::PADDING_Y, Base::POUND_SIGN, Base::TEXT_ALIGN, Base::TEXT_DECORATION, Base::TEXT_SHADOW, Base::TEXT_SHADOW_BLUR, Base::TEXT_SHADOW_OFFSET, Base::VERTICAL_ALIGN, Base::WEBKIT_ANIMATION, Base::WHITE_SPACE, Base::ZERO_WIDTH_NON_BREAKING_SPACE, Base::ZERO_WIDTH_SPACE
Instance Method Summary collapse
Instance Method Details
#render(tag, opt, ctx) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/inkcite/renderer/redacted.rb', line 5 def render tag, opt, ctx # Like Lorem Ipsum, warn the creator that there is redaction in # the email unless the warn parameter is true. ctx.error 'Email contains redacted content' unless opt[:force] # The obscuring character defaults to 'x' but can be overridden # using the 'with' attribute. with = opt[:with] || 'x' # Grab the text to be redacted, then apply the correct obscuring # character based on the case of the original letters. text = opt[:text] text.gsub!(/[A-Z]/, with.upcase) text.gsub!(/[a-z0-9]/, with.downcase) text end |