Sha256: 9f59598febcfe4a227e9469cd852585275f9e9c58a69aeeba5f52c1fd50bed53

Contents?: true

Size: 578 Bytes

Versions: 3

Compression:

Stored size: 578 Bytes

Contents

#!/usr/bin/env ruby
require File.expand_path(File.dirname(__FILE__) + '/../spec/spec_helper')

class Post
  include ROXML
  
  xml_reader :href, :attr
  xml_reader :hash, :attr
  xml_reader :description, :attr
  xml_reader :tag, :attr
  xml_reader :time, :attr, :as => DateTime
  xml_reader :others, :attr, :as => Integer
  xml_reader :extended, :attr
end

class Posts
  include ROXML

  xml_reader :posts, [Post]
end

unless defined?(Spec)
  posts = Posts.from_xml(xml_for('posts'))
  posts.posts.each do |post|
    puts post.description, post.href, post.extended, ''
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
Empact-roxml-2.4.3 examples/posts.rb
roxml-2.4.2 examples/posts.rb
roxml-2.4.3 examples/posts.rb