Class: Gamefic::Query::PluralChildren

Inherits:
AmbiguousChildren show all
Defined in:
lib/gamefic/query/plural_children.rb

Constant Summary

Constants included from Gamefic

DOWN, EAST, NORTH, NORTHEAST, NORTHWEST, SOUTH, SOUTHEAST, SOUTHWEST, UP, VERSION, WEST

Instance Attribute Summary

Attributes inherited from Base

#arguments

Instance Method Summary collapse

Methods inherited from AmbiguousChildren

#allow_ambiguous?

Methods inherited from ManyChildren

#allow_many?

Methods inherited from Children

#base_specificity, #context_from

Methods inherited from Base

#allow_ambiguous?, #allow_many?, #base_specificity, #context_from, #initialize, #last_match_for, #match, #optional?, #signature, #specificity, #test_arguments

Constructor Details

This class inherits a constructor from Gamefic::Query::Base

Instance Method Details

#execute(subject, description) ⇒ Object



2
3
4
5
6
7
# File 'lib/gamefic/query/plural_children.rb', line 2

def execute(subject, description)
  if (!description.end_with?("s") and !description.end_with?("i") and !description.end_with?("ae")) or (description.end_with?("ous") or description.end_with?("ess"))
    return Gamefic::Query::Matches.new([], '', description)
  end
  super
end

#validate(subject, object) ⇒ Object



8
9
10
11
12
13
# File 'lib/gamefic/query/plural_children.rb', line 8

def validate(subject, object)
  # Plural queries always return false on validation. Their only purpose is
  # to provide syntactic sugar for plural nouns, so it should never get triggered
  # by a token call.
  false
end