Sha256: de6f2aaf17e11e7991e9f4f90bfb9f7857f000f8e823dbfe0e98245a806772ef

Contents?: true

Size: 703 Bytes

Versions: 17

Compression:

Stored size: 703 Bytes

Contents

module Atom
  module Extensions
    class Property
      include Atom::Xml::Parseable

      namespace "http://custom.namespace"
      attribute :name, :value

      def initialize(name = nil, value = nil)
        if name && value
          initialize_with_o :name => name, :value => value
        else
          initialize_with_o(name) { yield if block_given? }
        end
      end

      def initialize_with_o(o = nil)
        case o
        when String, XML::Reader
          parse o, :once => true
        when Hash
          o.each do |name,value|
            self.send :"#{name}=", value
          end
        else
          yield(self) if block_given?
        end
      end
    end  
  end
end

Version data entries

17 entries across 17 versions & 3 rubygems

Version Path
ratom-0.9.0 spec/property.rb
ratom-0.8.2 spec/property.rb
ratom-0.8.1 spec/property.rb
ratom-0.8.0 spec/property.rb
ratom-0.7.2 spec/property.rb
ratom-0.7.1 spec/property.rb
ratom-0.7.0 spec/property.rb
ratom-0.6.10 spec/property.rb
ratom-instructure-0.6.9 spec/property.rb
ratom-0.6.9 spec/property.rb
ratom-0.6.8 spec/property.rb
ratom-ssl-0.1.0 spec/property.rb
ratom-0.6.7 spec/property.rb
ratom-0.6.6 spec/property.rb
ratom-ssl-0.0.0 spec/property.rb
ratom-0.6.5 spec/property.rb
ratom-0.6.4 spec/property.rb