Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/chronic/chronic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def get_tag(tag_class)

# Print this Token in a pretty way
def to_s
@word << '(' << @tags.join(', ') << ') '
@word + '(' + @tags.join(', ') + ')'
end
end

Expand All @@ -226,7 +226,7 @@ def -(seconds)

# Prints this span in a nice fashion
def to_s
'(' << self.begin.to_s << '..' << self.end.to_s << ')'
'(' + self.begin.to_s + '..' + self.end.to_s + ')'
end

unless RUBY_VERSION =~ /1\.9\./
Expand Down
4 changes: 2 additions & 2 deletions lib/chronic/grabber.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ def self.scan_for_all(token)
end

def to_s
'grabber-' << @type.to_s
'grabber-' + @type.to_s
end
end

#end
#end
2 changes: 1 addition & 1 deletion lib/chronic/ordinal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def to_s

class OrdinalDay < Ordinal #:nodoc:
def to_s
super << '-day-' << @type.to_s
super + '-day-' + @type.to_s
end
end

Expand Down
4 changes: 2 additions & 2 deletions lib/chronic/pointer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ def self.scan_for_all(token)
end

def to_s
'pointer-' << @type.to_s
'pointer-' + @type.to_s
end
end

end
end
4 changes: 2 additions & 2 deletions lib/chronic/repeaters/repeater_day.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@ def width
end

def to_s
super << '-day'
super + '-day'
end
end
end
4 changes: 2 additions & 2 deletions lib/chronic/repeaters/repeater_day_name.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def width
end

def to_s
super << '-dayname-' << @type.to_s
super + '-dayname-' + @type.to_s
end

private
Expand All @@ -48,4 +48,4 @@ def symbol_to_number(sym)
lookup = {:sunday => 0, :monday => 1, :tuesday => 2, :wednesday => 3, :thursday => 4, :friday => 5, :saturday => 6}
lookup[sym] || raise("Invalid symbol specified")
end
end
end
4 changes: 2 additions & 2 deletions lib/chronic/repeaters/repeater_day_portion.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,6 @@ def width
end

def to_s
super << '-dayportion-' << @type.to_s
super + '-dayportion-' + @type.to_s
end
end
end
4 changes: 2 additions & 2 deletions lib/chronic/repeaters/repeater_fortnight.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,6 @@ def width
end

def to_s
super << '-fortnight'
super + '-fortnight'
end
end
end
4 changes: 2 additions & 2 deletions lib/chronic/repeaters/repeater_hour.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,6 @@ def width
end

def to_s
super << '-hour'
super + '-hour'
end
end
end
4 changes: 2 additions & 2 deletions lib/chronic/repeaters/repeater_minute.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,6 @@ def width
end

def to_s
super << '-minute'
super + '-minute'
end
end
end
2 changes: 1 addition & 1 deletion lib/chronic/repeaters/repeater_month.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,6 @@ def width
end

def to_s
super << '-month'
super + '-month'
end
end
4 changes: 2 additions & 2 deletions lib/chronic/repeaters/repeater_month_name.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def index
end

def to_s
super << '-monthname-' << @type.to_s
super + '-monthname-' + @type.to_s
end

private
Expand All @@ -95,4 +95,4 @@ def symbol_to_number(sym)
:december => 12}
lookup[sym] || raise("Invalid symbol specified")
end
end
end
4 changes: 2 additions & 2 deletions lib/chronic/repeaters/repeater_season.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def width
end

def to_s
super << '-season'
super + '-season'
end

private
Expand Down Expand Up @@ -147,4 +147,4 @@ def num_seconds_til_start(season_symbol, direction)
def num_seconds_til_end(season_symbol, direction)
num_seconds_til(SEASONS[season_symbol].end, direction)
end
end
end
4 changes: 2 additions & 2 deletions lib/chronic/repeaters/repeater_second.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ def width
end

def to_s
super << '-second'
super + '-second'
end
end
end
4 changes: 2 additions & 2 deletions lib/chronic/repeaters/repeater_time.rb
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,6 @@ def width
end

def to_s
super << '-time-' << @type.to_s
super + '-time-' + @type.to_s
end
end
end
4 changes: 2 additions & 2 deletions lib/chronic/repeaters/repeater_week.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,6 @@ def width
end

def to_s
super << '-week'
super + '-week'
end
end
end
4 changes: 2 additions & 2 deletions lib/chronic/repeaters/repeater_weekday.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def width
end

def to_s
super << '-weekday'
super + '-weekday'
end

private
Expand All @@ -74,4 +74,4 @@ def symbol_to_number(sym)
lookup = {:sunday => 0, :monday => 1, :tuesday => 2, :wednesday => 3, :thursday => 4, :friday => 5, :saturday => 6}
lookup[sym] || raise("Invalid symbol specified")
end
end
end
4 changes: 2 additions & 2 deletions lib/chronic/repeaters/repeater_weekend.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,6 @@ def width
end

def to_s
super << '-weekend'
super + '-weekend'
end
end
end
4 changes: 2 additions & 2 deletions lib/chronic/repeaters/repeater_year.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,6 @@ def width
end

def to_s
super << '-year'
super + '-year'
end
end
end
6 changes: 3 additions & 3 deletions lib/chronic/scalar.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,19 +76,19 @@ def to_s

class ScalarDay < Scalar #:nodoc:
def to_s
super << '-day-' << @type.to_s
super + '-day-' + @type.to_s
end
end

class ScalarMonth < Scalar #:nodoc:
def to_s
super << '-month-' << @type.to_s
super + '-month-' + @type.to_s
end
end

class ScalarYear < Scalar #:nodoc:
def to_s
super << '-year-' << @type.to_s
super + '-year-' + @type.to_s
end
end

Expand Down
12 changes: 6 additions & 6 deletions lib/chronic/separator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,32 +60,32 @@ def to_s

class SeparatorComma < Separator #:nodoc:
def to_s
super << '-comma'
super + '-comma'
end
end

class SeparatorSlashOrDash < Separator #:nodoc:
def to_s
super << '-slashordash-' << @type.to_s
super + '-slashordash-' + @type.to_s
end
end

class SeparatorAt < Separator #:nodoc:
def to_s
super << '-at'
super + '-at'
end
end

class SeparatorIn < Separator #:nodoc:
def to_s
super << '-in'
super + '-in'
end
end

class SeparatorOn < Separator #:nodoc:
def to_s
super << '-on'
super + '-on'
end
end

end
end
10 changes: 8 additions & 2 deletions test/test_Token.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,11 @@ def test_token
assert_equal 1, token.tags.size
assert_equal 'foo', token.word
end

end

def test_tag_word
token = Chronic::Token.new('epic')
assert_equal 'epic', token.word
token.to_s
assert_equal 'epic', token.word
end
end