Module: Normatron

Defined in:
lib/normatron.rb,
lib/normatron/filters.rb,
lib/normatron/version.rb,
lib/normatron/extensions.rb,
lib/normatron/configuration.rb,
lib/normatron/filters/helpers.rb,
lib/normatron/filters/dump_filter.rb,
lib/normatron/filters/keep_filter.rb,
lib/normatron/filters/ascii_filter.rb,
lib/normatron/filters/blank_filter.rb,
lib/normatron/filters/chomp_filter.rb,
lib/normatron/filters/strip_filter.rb,
lib/normatron/filters/remove_filter.rb,
lib/normatron/filters/squish_filter.rb,
lib/normatron/filters/upcase_filter.rb,
lib/normatron/filters/squeeze_filter.rb,
lib/normatron/filters/camelize_filter.rb,
lib/normatron/filters/downcase_filter.rb,
lib/normatron/filters/swapcase_filter.rb,
lib/normatron/filters/titleize_filter.rb,
lib/normatron/extensions/active_record.rb,
lib/normatron/filters/dasherize_filter.rb,
lib/normatron/filters/capitalize_filter.rb,
lib/normatron/filters/underscore_filter.rb,
lib/generators/normatron/install_generator.rb

Defined Under Namespace

Modules: Extensions, Filters Classes: Configuration, InstallGenerator

Constant Summary collapse

VERSION =
"0.3.3"

Class Method Summary collapse

Class Method Details

.build_hash(*terms) ⇒ Object


15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/normatron.rb', line 15

def build_hash(*terms)
  terms.flatten!(1)

  filters_hash = {}
  terms.each do |term|
    case term
      when Array
        key, value = term.first, term.drop(1)
        filters_hash[key.to_sym] = value.kind_of?(Array) && value.empty? ? nil : value
      when Hash
        term.each { |key, value| filters_hash[key.to_sym] = *value }
      else
        filters_hash[term.to_sym] = nil
    end
  end

  filters_hash
end

.configurationObject Also known as: config


6
7
8
# File 'lib/normatron.rb', line 6

def configuration
  @configuration ||= Configuration.new
end

.setup {|configuration| ... } ⇒ Object

Yields:


11
12
13
# File 'lib/normatron.rb', line 11

def setup
  yield(configuration)
end