Ignore:
Timestamp:
May 6, 2008, 12:18:06 AM (16 years ago)
Author:
Tatsukawa, Akimichi
Message:

fixed Archetype::Constraint_Model and Primitive classes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ruby/trunk/models/am/archetype/constraint_model/archetype_constraint.rb

    r23 r32  
    1919            @occurrences = args[:occurrences] if args[:occurrences]
    2020            @rm_type_name = args[:rm_type_name] if args[:rm_type_name]
     21          end
     22
     23          def self.create(args = { }, &block)
     24            c_object = new(args)
     25            if block_given?
     26              yield c_object
     27            end
     28            return c_object
    2129          end
    2230        end
     
    4452        class C_PRIMITIVE_OBJECT < C_DEFINED_OBJECT
    4553          attr_accessor :item
    46          
     54
    4755          def initialize(args = { })
    4856            @attributes = args[:item] if args[:item]
     
    5361        class C_COMPLEX_OBJECT < C_DEFINED_OBJECT
    5462          attr_accessor :attributes, :attributes_valid
    55          
     63
    5664          def initialize(args = { })
    5765            @attributes = args[:attributes] ? args[:attributes] : []
     
    7381
    7482        class C_REFERENCE_OBJECT < C_OBJECT
    75          
    7683        end
    7784
    7885        class ARCHETYPE_INTERNAL_REF < C_REFERENCE_OBJECT
    79          
     86          attr_accessor :target_path
    8087        end
    8188
    8289        class ARCHETYPE_SLOT < C_REFERENCE_OBJECT
    83          
     90          attr_accessor :includes, :excludes
     91
     92          def self.create(args = { }, &block)
     93            archetype_slot = new(args)
     94            archetype_slot.includes = args[:includes]
     95            archetype_slot.excludes = args[:excludes]
     96            if block_given?
     97              yield archetype_slot
     98            end
     99            return archetype_slot
     100          end
    84101        end
    85102
    86103        class CONSTRAINT_REF < C_REFERENCE_OBJECT
    87          
     104          attr_accessor :reference
     105
     106          def self.create(args = { }, &block)
     107            constraint_ref = new(args)
     108            constraint_ref.reference = args[:reference]
     109            if block_given?
     110              yield constraint_ref
     111            end
     112            return constraint_ref
     113          end
    88114        end
    89115
Note: See TracChangeset for help on using the changeset viewer.