Sha256: 7254e6ca6d8b8eb09ec1eef334d4853f0c096fe6da8f3a349b2726365108b00e

Contents?: true

Size: 374 Bytes

Versions: 26

Compression:

Stored size: 374 Bytes

Contents

class Betterdocs::Sanitizer
  JSON_NONSTRING_TYPES = Tins::ModuleGroup[
    TrueClass,
    FalseClass,
    NilClass,
    Numeric,
    Array,
    Hash,
  ]

  def initialize(&sanitize)
    @sanitize = sanitize
  end

  def sanitize(value)
    @sanitize or return value
    if JSON_NONSTRING_TYPES === value
      value
    else
      @sanitize.(value.to_s)
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
betterdocs-0.13.0 lib/betterdocs/sanitizer.rb
betterdocs-0.12.5 lib/betterdocs/sanitizer.rb
betterdocs-0.12.4 lib/betterdocs/sanitizer.rb
betterdocs-0.12.3 lib/betterdocs/sanitizer.rb
betterdocs-0.12.2 lib/betterdocs/sanitizer.rb
betterdocs-0.12.1 lib/betterdocs/sanitizer.rb
betterdocs-0.12.0 lib/betterdocs/sanitizer.rb
betterdocs-0.11.0 lib/betterdocs/sanitizer.rb
betterdocs-0.10.0 lib/betterdocs/sanitizer.rb
betterdocs-0.9.2 lib/betterdocs/sanitizer.rb
betterdocs-0.9.1 lib/betterdocs/sanitizer.rb
betterdocs-0.9.0 lib/betterdocs/sanitizer.rb
betterdocs-0.8.1 lib/betterdocs/sanitizer.rb
betterdocs-0.8.0 lib/betterdocs/sanitizer.rb
betterdocs-0.7.1 lib/betterdocs/sanitizer.rb
betterdocs-0.7.0 lib/betterdocs/sanitizer.rb
betterdocs-0.6.8 lib/betterdocs/sanitizer.rb
betterdocs-0.6.7 lib/betterdocs/sanitizer.rb
betterdocs-0.6.6 lib/betterdocs/sanitizer.rb
betterdocs-0.6.5 lib/betterdocs/sanitizer.rb