Sha256: 4753b074decd2ad84d75f339ba27e1eeadd39e1e80a06ffb6344b3606c273c46

Contents?: true

Size: 607 Bytes

Versions: 9

Compression:

Stored size: 607 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?(RSpec)
  posts = Posts.from_xml(xml_for('posts'))
  posts.posts.each do |post|
    puts post.description, post.href, post.extended, ''
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
roxml-4.2.0 examples/posts.rb
roxml-4.1.1 examples/posts.rb
roxml-4.1.0 examples/posts.rb
roxml-4.0.0 examples/posts.rb
roxml-3.3.1 examples/posts.rb
roxml-3.3.0 examples/posts.rb
roxml-3.2.2 examples/posts.rb
roxml-3.2.1 examples/posts.rb
roxml-3.2.0 examples/posts.rb