class OpeningHoursConverter::Token
Attributes
made_from[RW]
start_index[R]
type[RW]
value[R]
Public Class Methods
new(value, type, start_index, made_from = [])
click to toggle source
# File lib/opening_hours_converter/token.rb, line 10 def initialize(value, type, start_index, made_from = []) @value = value @type = type @start_index = start_index @made_from = made_from end
Public Instance Methods
closing_square_bracket?()
click to toggle source
# File lib/opening_hours_converter/token.rb, line 97 def closing_square_bracket? @type == :closing_square_bracket end
colon?()
click to toggle source
# File lib/opening_hours_converter/token.rb, line 85 def colon? @type == :colon end
comma?()
click to toggle source
# File lib/opening_hours_converter/token.rb, line 77 def comma? @type == :comma end
hyphen?()
click to toggle source
# File lib/opening_hours_converter/token.rb, line 73 def hyphen? @type == :hyphen end
integer?()
click to toggle source
# File lib/opening_hours_converter/token.rb, line 69 def integer? @type == :integer end
month?()
click to toggle source
# File lib/opening_hours_converter/token.rb, line 29 def month? string? && OSM_MONTHS.any? { |day| day == @value } end
monthday?()
click to toggle source
# File lib/opening_hours_converter/token.rb, line 47 def monthday? # Nécessaire mais pas suffisant : 10 de 10:00 retourne true il faudra check le previous/next token pour décider integer? && @value.to_i <= 31 && @value.to_i >= 1 end
off?()
click to toggle source
# File lib/opening_hours_converter/token.rb, line 61 def off? string? && @value.downcase == 'off' end
opening_square_bracket?()
click to toggle source
# File lib/opening_hours_converter/token.rb, line 93 def opening_square_bracket? @type == :opening_square_bracket end
public_holiday?()
click to toggle source
# File lib/opening_hours_converter/token.rb, line 57 def public_holiday? string? && @value.downcase == 'ph' end
quote?()
click to toggle source
# File lib/opening_hours_converter/token.rb, line 81 def quote? @type == :quote end
slash?()
click to toggle source
# File lib/opening_hours_converter/token.rb, line 89 def slash? @type == :slash end
string?()
click to toggle source
# File lib/opening_hours_converter/token.rb, line 65 def string? @type == :string end
time?()
click to toggle source
# File lib/opening_hours_converter/token.rb, line 52 def time? # Nécessaire mais pas suffisant : 10 de Jan 10 retourne true il faudra check le previous/next token pour décider integer? && @value.to_i < 60 && @value.to_i >= 0 end
to_s()
click to toggle source
# File lib/opening_hours_converter/token.rb, line 17 def to_s "Token(value: #{@value}, type: #{@type}, start_index: #{@start_index})" end
week?()
click to toggle source
# File lib/opening_hours_converter/token.rb, line 33 def week? string? && @value == 'week' end
week_index?()
click to toggle source
# File lib/opening_hours_converter/token.rb, line 37 def week_index? # Nécessaire mais pas suffisant : 10 de 10:00 retourne true il faudra check le previous/next token pour décider ou garder le state week integer? && @value.to_i <= 53 && @value.to_i >= 1 end
weekday?()
click to toggle source
# File lib/opening_hours_converter/token.rb, line 25 def weekday? string? && OSM_DAYS.any? { |day| day == @value } end
weekday_modifier?()
click to toggle source
# File lib/opening_hours_converter/token.rb, line 42 def weekday_modifier? # Nécessaire mais pas suffisant : 10 de 10:00 retourne true il faudra check le previous/next token pour décider ou garder le state week integer? && (@value.to_i <= 5 && @value.to_i >= 1) || @value.to_i == -1 end
year?()
click to toggle source
# File lib/opening_hours_converter/token.rb, line 21 def year? integer? && @value.length == 4 end