Sha256: ecef52c2b69b4cfc366dba1c1ff720102fb1363e0836b64ed6050f6c82001a9e

Contents?: true

Size: 425 Bytes

Versions: 1

Compression:

Stored size: 425 Bytes

Contents

# NOTE:
#  Make a JSON Resource Descriptor (JRD) gem as separate one and use it as superclass?

module WebFinger
  class Response < Hash
    def initialize(jrd)
      replace jrd
    end

    [:subject, :aliases, :properties, :links].each do |method|
      define_method method do
        self[method]
      end
    end

    def link_for(rel)
      links.detect do |link|
        link[:rel] == rel
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
webfinger-0.0.3 lib/webfinger/response.rb