class Environmental
   @@convert_yaml = nil
   def self.yaml
     if @@convert_yaml.nil? then
  @@convert_yaml = YAML::load_file('nizam.yaml')
     end
     @@convert_yaml
   end
end

------------------------------------------------------------------
      - name: Optimisation
        type: Objective
        subtype: None
        components:
        - type: ContentBox
          title: Optimisation
          args:
            :content: |
              None

        - type: ChildListingComponent
          title: "Current Targets for the Optimisation Objective:"
-------------------------------------------------------------------
      - - name: Efficiency (Energy)
          type: Objective
          subtype: NIZAMMMzzz
          components:
          - type: ContentBox
            title: Team
            args:
              :content: |
                None

the input of my yaml file is similar as data within the dashed line. The 
thing is, by eliminating the brackets as i mentioned earlier will 
eliminate the double dashes (- - name: Efficiency (Energy)), hence 
corrected the indentation on my yaml output file. I just dnt know how to 
eliminate that bracket since i added two hashes ('objective' and 'mon') 
into an array ('tar'). Is there any other way i can add those two hashes 
without inserting it into an array? My desire yaml output file is like 
this:

      - name: Optimisation
        type: Objective
        subtype: None
        components:
        - type: ContentBox
          title: Optimisation
          args:
            :content: |
              None

        - type: ChildListingComponent
          title: "Current Targets for the Optimisation Objective:"

      - name: Efficiency (Energy)
        type: Objective
        subtype: NIZAMMMzzz
        components:
        - type: ContentBox
          title: Team
          args:
            :content: |
              None

Thanks

Nizam

-- 
Posted via http://www.ruby-forum.com/.