Class: Eventual::WeekdayConstrain

Inherits:
Treetop::Runtime::SyntaxNode
  • Object
show all
Defined in:
lib/eventual/syntax_nodes.rb

Overview

:nodoc:

Direct Known Subclasses

WeekdayPeriodConstrain

Instance Method Summary collapse

Instance Method Details

#valueObject



30
31
32
33
34
35
36
37
38
# File 'lib/eventual/syntax_nodes.rb', line 30

def value
  text    = wdays_node.text_value.sub('semana', '').sub(/^de\s/, '')
  days    = text.scan(WdayListR).map{ |d| WdaysR.index /#{d}/ }
  days   += (1..5).to_a if text.include?('entre')
  days   += [6,0] if text.include?('fines')
  days.sort!
  days    = (days.first..days.last).to_a if text.match /\sal?\s/
  days.uniq
end