Sha256: d360707327851e703acd8555f419b383da20aae7e81fb675b11a1276b67ef2ae

Contents?: true

Size: 696 Bytes

Versions: 1

Compression:

Stored size: 696 Bytes

Contents

module Tokamak
  module Xml
        
    # an object to represent a list of links that can be invoked
    class Links
      
      def initialize(links)
        @hash = {}
        links = [links] unless links.kind_of? Array
        links = [] unless links
        links.each { |l|
          link = Tokamak::Xml::Link.new(l)
          @hash[link.rel.to_s] = link
        }
      end

      def [](name)
        @hash[name]
      end
      
      def size
        @hash.size
      end
      
      def keys
        @hash.keys
      end
      
      def method_missing(sym, *args)
        raise "Links can not receive arguments" unless args.empty?
        self[sym.to_s]
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tokamak-1.0.0.beta2 lib/tokamak/xml/links.rb