Sha256: a94aadd932b8a5a4c18cd1b880e4d854b9a07690a1d3aec5584ea5b63ed3fb0b

Contents?: true

Size: 1.19 KB

Versions: 8

Compression:

Stored size: 1.19 KB

Contents

# frozen_string_literal: true

class Model < ActiveRecord::Base
  normalizy :default

  normalizy :block                       , with: ->(value) { value.upcase }
  normalizy :symbol                      , with: :squish
  normalizy :array_symbol                , with: [:squish]
  normalizy :array_symbols               , with: %i[downcase squish]
  normalizy :hash_no_args                , with: { squish: { ignored: true } }
  normalizy :hash_with_args              , with: { strip: { side: :left } }
  normalizy :module_one_arg              , with: Normalizy::Filters::Blacklist
  normalizy :module_two_args             , with: Normalizy::Filters::Info
  normalizy :module_and_block            , with: :blacklist, &->(value) { value.upcase }
  normalizy :method_with_no_options_field, with: :method_with_no_options
  normalizy :method_with_options_field   , with: { method_with_options: { key: :value } }
  normalizy :native                      , with: :split
  normalizy :multiple                    , with: :downcase
  normalizy :multiple                    , with: :titleize

  def method_with_options(input, options = {})
    [input, options].join ', '
  end

  def method_with_no_options(input)
    input
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
normalizy-1.5.0 spec/support/models/model.rb
normalizy-1.4.0 spec/support/models/model.rb
normalizy-1.3.0 spec/support/models/model.rb
normalizy-1.2.0 spec/support/models/model.rb
normalizy-1.1.1 spec/support/models/model.rb
normalizy-1.1.0 spec/support/models/model.rb
normalizy-1.0.1 spec/support/models/model.rb
normalizy-1.0.0 spec/support/models/model.rb