class ConstraintsNlp

Public Class Methods

new() click to toggle source
Calls superclass method
# File lib/macrohub.rb, line 274
def initialize()
  
  super()
  
  params = {}
  constraints(params)
  
end

Protected Instance Methods

constraints(params) click to toggle source
# File lib/macrohub.rb, line 285
def constraints(params) 

  puts 'inside constraints' if $debug
  # e.g. Between 8am and 10am
  #
  get /^between (.*)/i do |s|
    [TimeConstraint,  {time: s}]
  end
  
  get /^on a (.*)/i do |s|
    [TimeConstraint, {time: s}]
  end
  
  get /^(after .*)/i do |s|
    [TimeConstraint, {time: s}]
  end      
  
  get /^(#{(Date::DAYNAMES + Date::ABBR_DAYNAMES).join('|')}$)/i do |s|
    [TimeConstraint, {time: s}]
  end    
  
  get /^once only|only once|once|one time|1 time$/i do |s|
    [FrequencyConstraint, {freq: 1}]
  end
  
  get /^twice only|only twice|twice|two times|2 times$/i do |s|
    [FrequencyConstraint, {freq: 2}]
  end
  
  get /^(Maximum|Max|Up to) ?three times|3 times$/i do |s|
    [FrequencyConstraint, {freq: 3}]
  end                    
  
  get /^(Maximum|Max|Up to) ?four times|4 times$/i do |s|
    [FrequencyConstraint, {freq: 4}]
  end                          

end