Sha256: 01ff3f8a6b38f00288be4d2f99579fce425aa4f746d345810e64185f3b8f954a

Contents?: true

Size: 1.14 KB

Versions: 1

Compression:

Stored size: 1.14 KB

Contents

module Tokamak
  module Representation
  module Atom
    class Entry < Base   
      def initialize(xml_obj = nil)
        @source = nil
        super(xml_obj)
        @reserved = Base::ATOM_ATTRIBUTES[:entry][:required] + Base::ATOM_ATTRIBUTES[:entry][:recommended] + Base::ATOM_ATTRIBUTES[:entry][:optional]
      end
       
      # text
      def content
        text("content")
      end
  
      def content=(value)
        set_text("content", value)
      end
    
      # text
      def summary
        text("summary")
      end
  
      def summary=(value)
        set_text("summary", value)
      end
    
      # rfc 3339
      def published
        value = text("published")
        Time.parse(value) unless value.nil?
      end
  
      def published=(value)
        set_text("published", value)
      end
    
      # comp: id, title, udpated, rights (optional)
      def source
        unless @source
          @doc.xpath("xmlns:source").each do |source|
            @source = Generator.new(source)
          end 
        end
        
        return source
      end
      
      def source=(obj)
        @source = obj
      end
    end
  end
end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tokamak-1.0.0.beta2 lib/tokamak/representation/atom/entry.rb