Sha256: af789ee12bd69e347bd3ce75c2def20abcb2d07a1a7b4f851cf7d34b466a72a5

Contents?: true

Size: 606 Bytes

Versions: 2

Compression:

Stored size: 606 Bytes

Contents

#!/usr/bin/env ruby
require_relative './../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 :created_at, :from => '@time'
  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

2 entries across 2 versions & 2 rubygems

Version Path
representable-0.0.1.alpha1 examples/posts.rb
roxml-3.1.6 examples/posts.rb