lib/onebox/engine/stack_exchange_onebox.rb in onebox-2.2.12 vs lib/onebox/engine/stack_exchange_onebox.rb in onebox-2.2.13
- old
+ new
@@ -35,20 +35,21 @@
"https://api.stackexchange.com/2.2/questions/#{question_id}?site=#{domain}&filter=!5-duuxrJa-iw9oVvOA(JNimB5VIisYwZgwcfNI"
end
end
def data
- return @data if @data
+ return @data if defined?(@data)
result = raw['items'][0]
if result
result['creation_date'] =
Time.at(result['creation_date'].to_i).strftime("%I:%M%p - %d %b %y %Z")
result['tags'] = result['tags'].take(4).join(', ')
result['is_answer'] = result.key?('answer_id')
result['is_question'] = result.key?('question_id')
end
+
@data = result
end
end
end
end