class Variable
Attributes
constraints[RW]
demanded_inflections[RW]
inflections_delegated_to_me[RW]
palette_name[RW]
Public Class Methods
new(dsl_string)
click to toggle source
# File lib/dunmanifestin/phrase.rb, line 71 def initialize dsl_string components = dsl_string.split(/\b/) self.palette_name = components.shift self.inflections_delegated_to_me = [] self.demanded_inflections = [] self.constraints = [] components.each_with_index do |v, k| case components[k-1] when '#' inflections_delegated_to_me << v.to_sym when '.' demanded_inflections << v.to_sym when ':' constraints << v.to_sym end end end
Public Instance Methods
delegated_article?()
click to toggle source
# File lib/dunmanifestin/phrase.rb, line 101 def delegated_article? inflections_delegated_to_me.include? :article end
delegated_plural?()
click to toggle source
# File lib/dunmanifestin/phrase.rb, line 97 def delegated_plural? inflections_delegated_to_me.include? :plural end
delegated_possessive?()
click to toggle source
# File lib/dunmanifestin/phrase.rb, line 105 def delegated_possessive? inflections_delegated_to_me.include? :possessive end
reify(genre, inflections_of_parent_phrase)
click to toggle source
# File lib/dunmanifestin/phrase.rb, line 91 def reify genre, inflections_of_parent_phrase inherited_inflections = inflections_of_parent_phrase & inflections_delegated_to_me inflections = demanded_inflections | inherited_inflections genre.palette_named(palette_name).sample genre, inflections, constraints end