Changeset 250


Ignore:
Timestamp:
Sep 7, 2009, 3:59:20 PM (15 years ago)
Author:
KOBAYASHI, Shinji
Message:

move DvQuantity test to spec

Location:
ruby/branches/0.5
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • ruby/branches/0.5/lib/open_ehr/rm/data_types/quantity.rb

    r249 r250  
    146146          def initialize(args = {})
    147147            super(args)
    148             self.accuracy = accuracy
     148            self.accuracy = args[:accuracy]
    149149          end
    150150
     
    226226        class DvQuantity < DvAmount
    227227          attr_reader :units, :precision
    228           def initialize(magnitude, units, magnitude_status=nil, precision=nil,
    229                          accuracy=nil, accuracy_percent=nil, normal_range=nil,
    230                          normal_status = nil, other_reference_ranges=nil)
    231             super(magnitude, magnitude_status, accuracy, accuracy_percent,
    232                   normal_range, normal_status, other_reference_ranges)
    233             self.units = units
    234             self.precision = precision
     228
     229          def initialize(args = {})
     230            super(args)
     231            self.units = args[:units]
     232            self.precision = args[:precision]
    235233          end
    236234
     
    248246
    249247          def is_strictly_comparable_to?(others)
    250             return false if others.nil?
    251             if others.instance_of?(DvQuantity) && others.units == @units
     248            unless super(others)
     249              return false
     250            end
     251            if others.units == @units
    252252              return true
    253253            else
     
    262262              return true
    263263            end
    264           end
    265 # accuracy???
    266           def +(other)
    267             dv_amount = super(other)
    268             return DvQuantity.new(dv_amount.magnitude, @units,
    269                                    @magnitude_status, @precision,
    270                                    @accuracy, @accuracy_percent, @normal_range,
    271                                    @normal_status, @other_reference_ranges)
    272264          end
    273265        end
Note: See TracChangeset for help on using the changeset viewer.