Skip to content

Instantly share code, notes, and snippets.

View lukesarnacki's full-sized avatar

Łukasz Sarnacki lukesarnacki

View GitHub Profile
@lukesarnacki
lukesarnacki / gist:3721654
Created September 14, 2012 12:30
ember example
.
class YmlLength
attr_accessor :data, :result
def initialize(path)
self.data = YAML::load_file(Rails.root.join(path)).to_a.flatten.last
self.result = ""
get_value(data)
end
<objects type="array">
<object>
<id type="integer">1</id>
<name>Śmietanka łaciata</name>
<description nil="true"/>
<company-name>Mlekpol</company-name>
<ingredients type="array">
<ingredient>
<id type="integer">1</id>
<number>E339</number>
List<Product> products;
products = (from item in xdoc.Descendants("object")
select new Product()
{
Name = item.Element("name").Value,
Description = item.Element("description").Value
}).ToList();