Sha256: fcb39baa4c9a79b37814f24d74e917c96a48cf96cb5536e11144e528c21292ea

Contents?: true

Size: 639 Bytes

Versions: 11

Compression:

Stored size: 639 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 :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

11 entries across 11 versions & 5 rubygems

Version Path
Empact-roxml-2.5.2 examples/posts.rb
Empact-roxml-2.5.3 examples/posts.rb
doxo-roxml-2.5.3 examples/posts.rb
yob-roxml-3.1.6 examples/posts.rb
roxml-3.1.5 examples/posts.rb
roxml-3.1.4 examples/posts.rb
roxml-3.1.3 examples/posts.rb
roxml-3.1.2 examples/posts.rb
roxml-3.1.1 examples/posts.rb
roxml-3.1.0 examples/posts.rb
ROXML-3.0.0 examples/posts.rb