Changeset 128
- Timestamp:
- May 26, 2009, 7:18:08 PM (15 years ago)
- Location:
- ruby/trunk/lib/models
- Files:
-
- 4 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
ruby/trunk/lib/models/assumed_library_types.rb
r126 r128 446 446 447 447 def years=(years) 448 unless years.nil? || years > 0448 unless years.nil? || years >= 0 449 449 raise ArgumentError, 'years must be above zero' 450 450 end … … 453 453 454 454 def months=(months) 455 unless months.nil? || months > 0455 unless months.nil? || months >= 0 456 456 raise ArgumentError, 'months must be above zero' 457 457 end … … 460 460 461 461 def weeks=(weeks) 462 unless weeks.nil? || weeks > 0462 unless weeks.nil? || weeks >= 0 463 463 raise ArgumentError, 'weeks must be above zero' 464 464 end … … 467 467 468 468 def days=(days) 469 unless days.nil? || days > 0469 unless days.nil? || days >= 0 470 470 raise ArgumentError, 'days must be above zero' 471 471 end … … 474 474 475 475 def hours=(hours) 476 unless hours.nil? || hours > 0476 unless hours.nil? || hours >= 0 477 477 raise ArgumentError, 'hours must be above zero' 478 478 end … … 481 481 482 482 def minutes=(minutes) 483 unless minutes.nil? || minutes > 0483 unless minutes.nil? || minutes >= 0 484 484 raise ArgumentError, 'minutes must be above zero' 485 485 end … … 488 488 489 489 def seconds=(seconds) 490 unless seconds.nil? || seconds > 0490 unless seconds.nil? || seconds >= 0 491 491 raise ArgumentError, 'seconds must be above zero' 492 492 end … … 495 495 496 496 def fractional_second=(fractional_second) 497 unless fractional_second.nil? || (fractional_second > 0 && fractional_second < 1.0)497 unless fractional_second.nil? || (fractional_second >= 0 && fractional_second < 1.0) 498 498 raise ArgumentError, 'fractional_second must be between 0.0 and 1.0' 499 499 end -
ruby/trunk/lib/models/rm.rb
r123 r128 36 36 autoload :Quantity, "rm/data_types/quantity.rb" 37 37 end 38 39 module Data_Structures 40 autoload :Data_Structure, "rm/data_structure.rb" 41 end 38 42 end 39 43 -
ruby/trunk/lib/models/rm/common/archetyped.rb
r112 r128 16 16 class Pathable 17 17 attr_accessor :parent 18 18 19 def initialize(parent = nil) 19 20 @parent = parent 20 21 end 22 21 23 def item_at_path(path) 22 24 raise NotImplementError, "item_at_path must be implemented" 23 25 end 26 24 27 def items_at_path(path) 25 28 raise NotImplementError, "items_at_path must be implemented" 26 29 end 30 27 31 def path_exists?(path) 28 32 raise NotImplementError, "path_exists? must be implemented" 29 33 end 34 30 35 def path_of_item(item) 31 36 raise NotImplementError, "path_of_item must be implemented" 32 37 end 38 33 39 def path_unique(path) 34 40 raise NotImplementError, "path_unique must be implemented" … … 40 46 attr_reader :archetype_node_id, :name, :links 41 47 attr_accessor :uid, :archetype_details, :feeder_audit 48 42 49 def initialize(archetype_node_id, name, links, parent=nil, uid=nil, archetype_details=nil, feeder_audit=nil) 43 50 super(parent) -
ruby/trunk/lib/models/rm/data_structure.rb
r123 r128 3 3 # http://www.openehr.org/uml/release-1.0.1/Browsable/_9_5_1_76d0249_1140447518205_872539_864Report.html 4 4 # refs #59 5 module Data_Structures 6 class Data_Structure 7 def as_hierarchy 8 raise NotImplementError, "as_hirarchy must be implemented" 9 end 10 end 11 end 5 6 module OpenEHR 7 module RM 8 module Data_Structures 9 class Data_Structure < OpenEHR::RM::Common::Archetyped::Locatable 10 def as_hierarchy 11 raise NotImplementedError, "as_hirarchy must be implemented" 12 end 13 end 14 end # of Data_Structures 15 end # of RM 16 end # of OpenEHR -
ruby/trunk/lib/models/tests/rm/test_common.rb
r119 r128 25 25 assert_nothing_raised(Exception){@archetyped = OpenEHR::RM::Common::Archetyped::Archetyped.new(@archetype_id, '1.0.1')} 26 26 assert_nothing_raised(Exception){@link = OpenEHR::RM::Common::Archetyped::Link.new(OpenEHR::RM::Data_Types::Text::DV_Text.new("generic"), OpenEHR::RM::Data_Types::URI::DV_EHR_URI.new("ehr://test/"),OpenEHR::RM::Data_Types::Text::DV_Text.new("problem"))} 27 assert_nothing_raised(Exception){ 28 @pathable = OpenEHR::RM::Common::Archetyped::Pathable.new } 29 name = OpenEHR::RM::Data_Types::Text::DV_Text.new('blood') 30 links = Set.new([@uid_based_id]) 31 assert_nothing_raised(Exception){ 32 @locatable = OpenEHR::RM::Common::Archetyped::Locatable.new('at0001',name,links)} 27 33 end 28 34 … … 30 36 assert_instance_of OpenEHR::RM::Common::Archetyped::Archetyped, @archetyped 31 37 assert_instance_of OpenEHR::RM::Common::Archetyped::Link, @link 38 assert_instance_of OpenEHR::RM::Common::Archetyped::Pathable, @pathable 39 assert_instance_of OpenEHR::RM::Common::Archetyped::Locatable, @locatable 32 40 end 33 41
Note:
See TracChangeset
for help on using the changeset viewer.