Changeset 381


Ignore:
Timestamp:
Dec 21, 2009, 3:15:43 PM (14 years ago)
Author:
KOBAYASHI, Shinji
Message:

refs #74

Location:
ruby/trunk
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • ruby/trunk/lib/open_ehr/am/archetype/constraint_model.rb

    r380 r381  
    183183
    184184          def any_allowed?
    185             return !item.nil?
     185            return item.nil?
    186186          end
    187187        end
    188188
    189189        class CComplexObject < CDefinedObject
    190           attr_accessor :attributes, :attributes_valid
    191 
    192           def initialize(args = { })
    193             @attributes = args[:attributes] ? args[:attributes] : []
    194             super
     190          attr_accessor :attributes
     191
     192          def initialize(args = { })
     193            super
     194            self.attributes = args[:attributes]
     195          end
     196
     197          def any_allowed?
     198            return (@attributes.nil? or @attributes.empty?)
    195199          end
    196200
     
    205209
    206210        class CDomainType < CDefinedObject
    207          
     211          def standard_equivalent
     212            raise NotImplementedError, 'subclass should be defined'
     213          end
    208214        end
    209215
  • ruby/trunk/spec/lib/open_ehr/am/archetype/constraint_model/c_primitive_object_spec.rb

    r380 r381  
    2424
    2525  it 'should allowed any' do
    26     @c_primitive_object.should be_any_allowed
     26    @c_primitive_object.should_not be_any_allowed
    2727  end
    2828
    2929  it 'should not any allowed' do
    3030    @c_primitive_object.item = nil
    31     @c_primitive_object.should_not be_any_allowed
     31    @c_primitive_object.should be_any_allowed
    3232  end
    3333end
Note: See TracChangeset for help on using the changeset viewer.