Class: TimePatterns::IntervalEndingToken

Inherits:
Object
  • Object
show all
Defined in:
lib/todo_time_patterns/tokens.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(values) ⇒ IntervalEndingToken

Returns a new instance of IntervalEndingToken.



202
203
204
205
206
207
208
# File 'lib/todo_time_patterns/tokens.rb', line 202

def initialize(values)
  @values = values
  @values.extend(TokensStringRepresentation)

  set_start_and_end_indexes values
  set_time_and_interval values
end

Instance Attribute Details

#end_indexObject (readonly)

Returns the value of attribute end_index.



197
198
199
# File 'lib/todo_time_patterns/tokens.rb', line 197

def end_index
  @end_index
end

#hoursObject (readonly)

Returns the value of attribute hours.



199
200
201
# File 'lib/todo_time_patterns/tokens.rb', line 199

def hours
  @hours
end

#intervalObject (readonly)

Returns the value of attribute interval.



200
201
202
# File 'lib/todo_time_patterns/tokens.rb', line 200

def interval
  @interval
end

#minutesObject (readonly)

Returns the value of attribute minutes.



198
199
200
# File 'lib/todo_time_patterns/tokens.rb', line 198

def minutes
  @minutes
end

#start_indexObject (readonly)

Returns the value of attribute start_index.



196
197
198
# File 'lib/todo_time_patterns/tokens.rb', line 196

def start_index
  @start_index
end

Instance Method Details

#set_start_and_end_indexes(values) ⇒ Object



210
211
212
213
# File 'lib/todo_time_patterns/tokens.rb', line 210

def set_start_and_end_indexes(values)
  @start_index = values.first.start_index
  @end_index = values.last.end_index
end

#set_time_and_interval(values) ⇒ Object



215
216
217
218
219
220
221
# File 'lib/todo_time_patterns/tokens.rb', line 215

def set_time_and_interval(values)
  time = values[1]
  @minutes = time.minutes
  @hours = time.hours

  @interval = values[3].minutes
end

#to_sObject



223
224
225
# File 'lib/todo_time_patterns/tokens.rb', line 223

def to_s
  "{ending_form}"
end