File tree Expand file tree Collapse file tree 3 files changed +39
-1
lines changed
Expand file tree Collapse file tree 3 files changed +39
-1
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,19 @@ def to_a
3838 @latlng
3939 end
4040
41+ alias to_h to_a
42+ alias as_json to_a
43+
44+ def to_json ( *args )
45+ as_json . to_json ( args )
46+ end
47+
48+ def inspect
49+ @latlng . inspect
50+ end
51+
52+ alias to_s inspect
53+
4154 def initialize ( latlng = nil )
4255 @latlng = latlng
4356 end
Original file line number Diff line number Diff line change 11# frozen_string_literal: true
22
33module Strava
4- VERSION = '3.0.0.pre.1 '
4+ VERSION = '3.0.0.pre.2 '
55end
Original file line number Diff line number Diff line change 102102 expect ( latlng . to_a ) . to eq ( [ 40.7128 , -74.0060 ] )
103103 end
104104 end
105+
106+ describe '#to_h' do
107+ it 'returns the latlng array' do
108+ expect ( latlng . to_h ) . to eq ( [ 40.7128 , -74.0060 ] )
109+ end
110+ end
111+
112+ describe '#json' do
113+ it 'returns the array JSON' do
114+ expect ( latlng . as_json ) . to eq ( [ 40.7128 , -74.0060 ] )
115+ expect ( latlng . to_json ) . to eq ( [ 40.7128 , -74.0060 ] . to_json )
116+ end
117+ end
118+
119+ describe '#inspect' do
120+ it 'returns the array inspect' do
121+ expect ( latlng . inspect ) . to eq ( [ 40.7128 , -74.0060 ] . inspect )
122+ end
123+ end
124+
125+ describe 'to_s' do
126+ it 'returns the array to_s' do
127+ expect ( latlng . to_s ) . to eq ( [ 40.7128 , -74.0060 ] . to_s )
128+ end
129+ end
105130end
You can’t perform that action at this time.
0 commit comments