From jyip at westpac.com.au Tue Feb 12 17:04:02 2008 From: jyip at westpac.com.au (Jason Yip) Date: Wed, 13 Feb 2008 09:04:02 +1100 Subject: [Esp-users] YAML object creation strangeness In-Reply-To: Message-ID: Hi Lejo, Thanks for the suggestions. After some further experimentation, we decided to abandon the YAML approach and just configure in Ruby. Lejo Varughese 12/02/2008 11:31 PM To esp-users at rubyforge.org, jyip at westpac.com.au cc Subject Re: [Esp-users] YAML object creation strangeness Hi Jason, I am one of the developers on the ESP project at Thoughtworks. There are a couple of reasons why the YAML transform method wont work correctly. - The model object is not found on the path. Make sure the class is available on the load path. - There is a syntax error in your YAML file. Be careful to use single spaces instead of tabs. - It is unable to find the node to correctly perform the transformation. The key you pass into parse() was not found in the file (usually due to use of tabs). Here is the correct format for yaml model description (3 dashes below are part of the description).. --- server1: - !ruby/object:Server key1: value1 key2: value2 One way to get the correct format for your object would be to populate your object and call the to_yaml method like so ldap_server = LDAPServer.new ldap_server.url = '\\server' ldap_sever.user = 'username' ldap_server.password = 'password' . . . puts ldap_server.to_yaml Hope this helps. Please let me know if you need further assistance. _____________________ Lejo Varughese ThoughtWorks - Chicago Mobile: (214) 680 - 5356 YIM: lcooljv Rolf Russell/UK/ThoughtWorks 02/05/2008 10:55 PM To Lejo Varughese/US/ThoughtWorks at ThoughtWorks cc Subject Fw: [Esp-users] YAML object creation strangeness Did you have a chance to get back to Jason? ----- Forwarded by Rolf Russell/UK/ThoughtWorks on 02/05/2008 11:55 PM ----- Jason Yip Sent by: esp-users-bounces at rubyforge.org 01/31/2008 05:12 PM To esp-users at rubyforge.org cc Subject [Esp-users] YAML object creation strangeness This might be more of a YAML question but given that it's based on the sample, I figure I might as well as here first. In the example, ConfigReader is parsing a YAML file and using YAML::BasicNode.transform() to create Server objects? I'm trying to do the same thing to create my own LDAPServer objects but I end up with something else which looks to be some kind of YAML object instead. I was guessing that a line like this: - !ruby/object:LDAPServer in the YAML file would inform which object to transform to but I guessed wrong. Do I need to do some further type mapping? I didn't see this done in the example. Please consider our environment before printing this email. WARNING - This email and any attachments may be confidential. If received in error, please delete and inform us by return email. Because emails and attachments may be interfered with, may contain computer viruses or other defects and may not be successfully replicated on other systems, you must be cautious. Westpac cannot guarantee that what you receive is what we sent. If you have any doubts about the authenticity of an email by Westpac, please contact us immediately. It is also important to check for viruses and defects before opening or using attachments. Westpac's liability is limited to resupplying any affected attachments. This email and its attachments are not intended to constitute any form of financial advice or recommendation of, or an offer to buy or offer to sell, any security or other financial product. We recommend that you seek your own independent legal or financial advice before proceeding with any investment decision. Westpac Institutional Bank is a division of Westpac Banking Corporation, a company registered in New South Wales in Australia under the Corporations Act 2001 (Cth). Westpac is authorised and regulated in the United Kingdom by the Financial Services Authority and is registered at Cardiff in the United Kingdom as Branch No. BR 106. Westpac operates in the United States of America as a federally chartered branch, regulated by the Office of the Comptroller of the Currency. Westpac Banking Corporation ABN 33 007 457 141. _______________________________________________ Esp-users mailing list Esp-users at rubyforge.org http://rubyforge.org/mailman/listinfo/esp-users Please consider our environment before printing this email. WARNING - This email and any attachments may be confidential. If received in error, please delete and inform us by return email. Because emails and attachments may be interfered with, may contain computer viruses or other defects and may not be successfully replicated on other systems, you must be cautious. Westpac cannot guarantee that what you receive is what we sent. If you have any doubts about the authenticity of an email by Westpac, please contact us immediately. It is also important to check for viruses and defects before opening or using attachments. Westpac's liability is limited to resupplying any affected attachments. This email and its attachments are not intended to constitute any form of financial advice or recommendation of, or an offer to buy or offer to sell, any security or other financial product. We recommend that you seek your own independent legal or financial advice before proceeding with any investment decision. Westpac Institutional Bank is a division of Westpac Banking Corporation, a company registered in New South Wales in Australia under the Corporations Act 2001 (Cth). Westpac is authorised and regulated in the United Kingdom by the Financial Services Authority and is registered at Cardiff in the United Kingdom as Branch No. BR 106. Westpac operates in the United States of America as a federally chartered branch, regulated by the Office of the Comptroller of the Currency. Westpac Banking Corporation ABN 33 007 457 141. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/esp-users/attachments/20080213/e905a8d6/attachment.html