Sha256: 82554194d96c99834f6a6f72ef820bc582edceb2e031e7649531c8e4c36594e8

Contents?: true

Size: 939 Bytes

Versions: 3

Compression:

Stored size: 939 Bytes

Contents

require 'fossil'
require 'logger'

DB = Sequel.fos('flyos', :loggers=>[Logger.new($stdout)])
[Trip,TripLeg].each{|m| m.db=DB}
#[Trip,TripLeg,Airport,AirportFbo,Aircraft,CrewLeg,Code,TripPassenger,Passenger,Personnel,Quote,Comment].each{|m| m.db=DB}
start_date = Date.parse('July 1 2010').to_fos_days
end_date = Date.parse('Aug 31 2010').to_fos_days
#p [start_date, end_date]
#p TripLeg.filter(:depart_date_key=> (start_date..end_date) ).count
#p Trip.filter(:departure_date_gmt=> (start_date..end_date) ).count
#t =  TripLeg["PHIP", 0, 17, 40257, 974]
#t.update(:kid_date=>40256)
#t.update(:kid_date => 40247)

def diff_hash(arr)
  Hash[*arr.collect{|v|[v[0],v[1]]}.flatten]
end

old_attrs = {:dan=>'cool',:jade=>'nice'}
new_attrs = {:dan=>'cool',:jade=>'there'}
old_diffs=diff_hash(old_attrs.to_a-new_attrs.to_a)
new_diffs=diff_hash(new_attrs.to_a-old_attrs.to_a)
old_diffs.each{|k,v| old_diffs[k] = [v,new_diffs[k]] if new_diffs[k]  }


Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fossil-0.5.12 spec/silly_spec.rb
fossil-0.5.11 spec/silly_spec.rb
fossil-0.5.10 spec/silly_spec.rb