Sha256: 8b753ec09ad76d980812841e6688895246f8487f28e2c42f3c54fc51a841a246

Contents?: true

Size: 503 Bytes

Versions: 7

Compression:

Stored size: 503 Bytes

Contents

require "microformat/attribute"
require "microformat/attribute_map"

module Microformat
  class AttributeDefinition
    attr_reader :attributes
    
    def initialize(&block)
      @attributes ||= {}
      block.yield(self)
    end
    
    def attribute(name, options = {}, &block)
      Attribute.new(name, options, &block).tap do |attribute|
        @attributes.merge!(name.to_sym => attribute)
      end
    end
    
    def map_to(document)
      AttributeMap.new(self, document)
    end
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
elcamino-microformat-0.0.8 lib/microformat/attribute_definition.rb
microformat-0.0.7 lib/microformat/attribute_definition.rb
microformat-0.0.6 lib/microformat/attribute_definition.rb
microformat-0.0.5 lib/microformat/attribute_definition.rb
microformat-0.0.4 lib/microformat/attribute_definition.rb
microformat-0.0.3 lib/microformat/attribute_definition.rb
microformat-0.0.2 lib/microformat/attribute_definition.rb