From 179d017f37ac952e4a0916b46a5261e6e97b3848 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Fri, 11 Mar 2011 14:04:50 -0500 Subject: [PATCH] more image work --- lib/avm/image.rb | 4 ++++ spec/avm/image_spec.rb | 10 +++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/avm/image.rb b/lib/avm/image.rb index 57570cd..5065a52 100644 --- a/lib/avm/image.rb +++ b/lib/avm/image.rb @@ -30,6 +30,10 @@ module AVM Time.parse(@options[:date]) end + def distance + [ light_years, redshift ] + end + def self.from_xml(string) document = AVM::XMP.from_string(string) diff --git a/spec/avm/image_spec.rb b/spec/avm/image_spec.rb index d0d94cf..acda524 100644 --- a/spec/avm/image_spec.rb +++ b/spec/avm/image_spec.rb @@ -20,7 +20,9 @@ describe AVM::Image do :date => date, :id => id, :type => type, - :image_quality => image_quality + :image_quality => image_quality, + :redshift => redshift, + :light_years => light_years } } let(:title) { 'My title' } @@ -33,6 +35,8 @@ describe AVM::Image do let(:id) { 'ID' } let(:type) { 'Obvservation' } let(:image_quality) { 'Good' } + let(:redshift) { 'Redshift' } + let(:light_years) { 'Light years' } its(:creator) { should be_a_kind_of(AVM::Creator) } its(:title) { should == title } @@ -45,6 +49,10 @@ describe AVM::Image do its(:id) { should == id } its(:image_type) { should == type } its(:image_quality) { should == image_quality } + its(:redshift) { should == redshift } + its(:light_years) { should == light_years } + + its(:distance) { should == [ light_years, redshift ] } end describe '#to_xml' do