Sha256: b4ecd97584ae081b40ccf8630ee7814acde8a41137dcb5ade6a4e1ce580f0e4f

Contents?: true

Size: 648 Bytes

Versions: 5

Compression:

Stored size: 648 Bytes

Contents

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

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

class Posts
  include ROXML

  xml_reader :posts, :as => [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

5 entries across 5 versions & 2 rubygems

Version Path
Empact-roxml-2.5.1 examples/posts.rb
roxml-2.5.1 examples/posts.rb
roxml-2.5.0 examples/posts.rb
roxml-2.5.2 examples/posts.rb
roxml-2.5.3 examples/posts.rb