diff --git a/lib/chronic/chronic.rb b/lib/chronic/chronic.rb index baeaed27..af24e4cf 100644 --- a/lib/chronic/chronic.rb +++ b/lib/chronic/chronic.rb @@ -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 @@ -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\./ diff --git a/lib/chronic/grabber.rb b/lib/chronic/grabber.rb index 4162a260..25d426e0 100644 --- a/lib/chronic/grabber.rb +++ b/lib/chronic/grabber.rb @@ -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 \ No newline at end of file +#end diff --git a/lib/chronic/ordinal.rb b/lib/chronic/ordinal.rb index ffef9287..143b5fe5 100644 --- a/lib/chronic/ordinal.rb +++ b/lib/chronic/ordinal.rb @@ -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 diff --git a/lib/chronic/pointer.rb b/lib/chronic/pointer.rb index 224efaf9..83b09383 100644 --- a/lib/chronic/pointer.rb +++ b/lib/chronic/pointer.rb @@ -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 \ No newline at end of file +end diff --git a/lib/chronic/repeaters/repeater_day.rb b/lib/chronic/repeaters/repeater_day.rb index 0cc9efde..a1ccd51e 100644 --- a/lib/chronic/repeaters/repeater_day.rb +++ b/lib/chronic/repeaters/repeater_day.rb @@ -47,6 +47,6 @@ def width end def to_s - super << '-day' + super + '-day' end -end \ No newline at end of file +end diff --git a/lib/chronic/repeaters/repeater_day_name.rb b/lib/chronic/repeaters/repeater_day_name.rb index 5d4a4d48..a8030ea7 100644 --- a/lib/chronic/repeaters/repeater_day_name.rb +++ b/lib/chronic/repeaters/repeater_day_name.rb @@ -39,7 +39,7 @@ def width end def to_s - super << '-dayname-' << @type.to_s + super + '-dayname-' + @type.to_s end private @@ -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 \ No newline at end of file +end diff --git a/lib/chronic/repeaters/repeater_day_portion.rb b/lib/chronic/repeaters/repeater_day_portion.rb index c4107632..03dbccb2 100644 --- a/lib/chronic/repeaters/repeater_day_portion.rb +++ b/lib/chronic/repeaters/repeater_day_portion.rb @@ -89,6 +89,6 @@ def width end def to_s - super << '-dayportion-' << @type.to_s + super + '-dayportion-' + @type.to_s end -end \ No newline at end of file +end diff --git a/lib/chronic/repeaters/repeater_fortnight.rb b/lib/chronic/repeaters/repeater_fortnight.rb index b8c98e3b..51fcb0aa 100644 --- a/lib/chronic/repeaters/repeater_fortnight.rb +++ b/lib/chronic/repeaters/repeater_fortnight.rb @@ -65,6 +65,6 @@ def width end def to_s - super << '-fortnight' + super + '-fortnight' end -end \ No newline at end of file +end diff --git a/lib/chronic/repeaters/repeater_hour.rb b/lib/chronic/repeaters/repeater_hour.rb index 79bac903..70d7c651 100644 --- a/lib/chronic/repeaters/repeater_hour.rb +++ b/lib/chronic/repeaters/repeater_hour.rb @@ -52,6 +52,6 @@ def width end def to_s - super << '-hour' + super + '-hour' end -end \ No newline at end of file +end diff --git a/lib/chronic/repeaters/repeater_minute.rb b/lib/chronic/repeaters/repeater_minute.rb index d198c728..8dbc0f47 100644 --- a/lib/chronic/repeaters/repeater_minute.rb +++ b/lib/chronic/repeaters/repeater_minute.rb @@ -52,6 +52,6 @@ def width end def to_s - super << '-minute' + super + '-minute' end -end \ No newline at end of file +end diff --git a/lib/chronic/repeaters/repeater_month.rb b/lib/chronic/repeaters/repeater_month.rb index fd7b58ba..63e62b7c 100644 --- a/lib/chronic/repeaters/repeater_month.rb +++ b/lib/chronic/repeaters/repeater_month.rb @@ -70,6 +70,6 @@ def width end def to_s - super << '-month' + super + '-month' end end diff --git a/lib/chronic/repeaters/repeater_month_name.rb b/lib/chronic/repeaters/repeater_month_name.rb index 07a764c4..efce7d99 100644 --- a/lib/chronic/repeaters/repeater_month_name.rb +++ b/lib/chronic/repeaters/repeater_month_name.rb @@ -75,7 +75,7 @@ def index end def to_s - super << '-monthname-' << @type.to_s + super + '-monthname-' + @type.to_s end private @@ -95,4 +95,4 @@ def symbol_to_number(sym) :december => 12} lookup[sym] || raise("Invalid symbol specified") end -end \ No newline at end of file +end diff --git a/lib/chronic/repeaters/repeater_season.rb b/lib/chronic/repeaters/repeater_season.rb index fe284945..b0d0e41f 100644 --- a/lib/chronic/repeaters/repeater_season.rb +++ b/lib/chronic/repeaters/repeater_season.rb @@ -106,7 +106,7 @@ def width end def to_s - super << '-season' + super + '-season' end private @@ -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 \ No newline at end of file +end diff --git a/lib/chronic/repeaters/repeater_second.rb b/lib/chronic/repeaters/repeater_second.rb index 75756479..b91cfe1d 100644 --- a/lib/chronic/repeaters/repeater_second.rb +++ b/lib/chronic/repeaters/repeater_second.rb @@ -36,6 +36,6 @@ def width end def to_s - super << '-second' + super + '-second' end -end \ No newline at end of file +end diff --git a/lib/chronic/repeaters/repeater_time.rb b/lib/chronic/repeaters/repeater_time.rb index 5f8c5088..e3d48036 100644 --- a/lib/chronic/repeaters/repeater_time.rb +++ b/lib/chronic/repeaters/repeater_time.rb @@ -120,6 +120,6 @@ def width end def to_s - super << '-time-' << @type.to_s + super + '-time-' + @type.to_s end -end \ No newline at end of file +end diff --git a/lib/chronic/repeaters/repeater_week.rb b/lib/chronic/repeaters/repeater_week.rb index bb80a831..269d963b 100644 --- a/lib/chronic/repeaters/repeater_week.rb +++ b/lib/chronic/repeaters/repeater_week.rb @@ -68,6 +68,6 @@ def width end def to_s - super << '-week' + super + '-week' end -end \ No newline at end of file +end diff --git a/lib/chronic/repeaters/repeater_weekday.rb b/lib/chronic/repeaters/repeater_weekday.rb index 36a214f4..7f7a6008 100644 --- a/lib/chronic/repeaters/repeater_weekday.rb +++ b/lib/chronic/repeaters/repeater_weekday.rb @@ -57,7 +57,7 @@ def width end def to_s - super << '-weekday' + super + '-weekday' end private @@ -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 \ No newline at end of file +end diff --git a/lib/chronic/repeaters/repeater_weekend.rb b/lib/chronic/repeaters/repeater_weekend.rb index 91d7d81f..42cdb58c 100644 --- a/lib/chronic/repeaters/repeater_weekend.rb +++ b/lib/chronic/repeaters/repeater_weekend.rb @@ -60,6 +60,6 @@ def width end def to_s - super << '-weekend' + super + '-weekend' end -end \ No newline at end of file +end diff --git a/lib/chronic/repeaters/repeater_year.rb b/lib/chronic/repeaters/repeater_year.rb index 66971d5d..6f39155e 100644 --- a/lib/chronic/repeaters/repeater_year.rb +++ b/lib/chronic/repeaters/repeater_year.rb @@ -59,6 +59,6 @@ def width end def to_s - super << '-year' + super + '-year' end -end \ No newline at end of file +end diff --git a/lib/chronic/scalar.rb b/lib/chronic/scalar.rb index 5ef20ce3..58fb5f56 100644 --- a/lib/chronic/scalar.rb +++ b/lib/chronic/scalar.rb @@ -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 diff --git a/lib/chronic/separator.rb b/lib/chronic/separator.rb index 768dc470..a748cfd1 100644 --- a/lib/chronic/separator.rb +++ b/lib/chronic/separator.rb @@ -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 \ No newline at end of file +end diff --git a/test/test_Token.rb b/test/test_Token.rb index 80463d1e..933273d3 100644 --- a/test/test_Token.rb +++ b/test/test_Token.rb @@ -22,5 +22,11 @@ def test_token assert_equal 1, token.tags.size assert_equal 'foo', token.word end - -end \ No newline at end of file + + def test_tag_word + token = Chronic::Token.new('epic') + assert_equal 'epic', token.word + token.to_s + assert_equal 'epic', token.word + end +end