Sha256: ca5b8482f676588370786a5cf4cc3d24182081754ef88a2aeba8eeea547a95ca

Contents?: true

Size: 713 Bytes

Versions: 12

Compression:

Stored size: 713 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, Nokogiri::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

12 entries across 12 versions & 1 rubygems

Version Path
ratom-nokogiri-0.10.11 spec/property.rb
ratom-nokogiri-0.10.10 spec/property.rb
ratom-nokogiri-0.10.9 spec/property.rb
ratom-nokogiri-0.10.8 spec/property.rb
ratom-nokogiri-0.10.7 spec/property.rb
ratom-nokogiri-0.10.6 spec/property.rb
ratom-nokogiri-0.10.5 spec/property.rb
ratom-nokogiri-0.10.4 spec/property.rb
ratom-nokogiri-0.10.3 spec/property.rb
ratom-nokogiri-0.10.2 spec/property.rb
ratom-nokogiri-0.10.1 spec/property.rb
ratom-nokogiri-0.10.0 spec/property.rb