class FuzzyWhere::Generators::PredicateGenerator

Generate a new fuzzy predicate

Public Instance Methods

add_fuzzy_predicate() click to toggle source
# File lib/generators/fuzzy_where/predicate_generator.rb, line 13
def add_fuzzy_predicate
  return if attributes.empty?
  append_to_file 'config/fuzzy_predicates.yml',
                 predicate_content(name, attributes)
end

Private Instance Methods

predicate_content(name, attributes) click to toggle source

Content for fuzzy predicate definition

# File lib/generators/fuzzy_where/predicate_generator.rb, line 22
      def predicate_content(name, attributes)
        buffer = <<-CONTENT
#{name}:
  min:   #{attributes[0].name}
  core1: #{attributes[1].name}
  core2: #{attributes[2].name}
  max:   #{attributes[3].name}
CONTENT
        buffer
      end