Sha256: 9b4970ae5909d5798869a97460c101e5a63de7791b3ef845d857baee62854195

Contents?: true

Size: 512 Bytes

Versions: 5

Compression:

Stored size: 512 Bytes

Contents

module Pivotal
  module Attributes
    
    def self.included(base)
      base.extend ClassMethods

      class << base
        attr_accessor :attributes
      end
    end
    
    module ClassMethods
      def has_attributes(*attributes)
        @attributes = attributes.map { |attribute| attribute.to_s }
        
        attributes.each do |attribute|
          define_method attribute do
            parsed_resource.xpath("*/" + attribute.to_s).text
          end
        end
      end
    end
    
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
git-pivotal-0.2.3 lib/pivotal/attributes.rb
idealian-git-pivotal-0.2.4 lib/pivotal/attributes.rb
idealian-git-pivotal-0.2.3 lib/pivotal/attributes.rb
git-pivotal-0.2.2 lib/pivotal/attributes.rb
git-pivotal-0.2.1 lib/pivotal/attributes.rb