Martian eyrie

December 19, 2006

Доступ к дереву XML как к обычным объектам

Filed under: RubyOnRails

Ruby on Rails в России

Доступ к дереву XML как к обычным объектам

Для этого можно использовать XSD::Mapping из стандартной библиотеки:

require ‘xsd/mapping’
people = XSD::Mapping.xml2obj(File.read("people.xml"))
people.person[2].name # => "name3"

Если в имени тэга присутствует дефис, можно сделать так: people[’foo-bar’]

Ну а выполнить обратное преобразование объектного дерева в XML поможет метод: XSD::Mapping.obj2xml

Save Time and Effort with Facets - O’Reilly Ruby

Filed under: RubyOnRails

Save Time and Effort with Facets - O’Reilly Ruby Given the immense popularity of Rails, it’s easy to overlook some of the other goldmines of the Ruby world. One of these gems is the Facets library. A collection of general-purpose methods and modules, Facets can keep you from engaging in repeated wheel-reinvention exercises in your Ruby projects. Most burgeoning Rubyists know to explore the Ruby Standard library, but I am continually surprised when talking with new Ruby developers who’ve never heard of Facets.

19 Rails Tricks Most Rails Coders Don’t Know

Filed under: RubyOnRails

19 Rails Tricks Most Rails Coders Don’t Know When looking at my own Rails code and that of the community as a whole, I often see places where certain Rails techniques could have been used, but weren’t. As much for my own memory as yours, I thought I’d list down some Rails tricks and tips that can make your application or code more efficient






















Get free blog up and running in minutes with Blogsome
Theme designed by Hadley Wickham