File: response.rb

package info (click to toggle)
ruby-webfinger 2.1.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 168 kB
  • sloc: ruby: 401; makefile: 7
file content (18 lines) | stat: -rw-r--r-- 410 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# NOTE:
#  Make a JSON Resource Descriptor (JRD) gem as separate one and use it as superclass?

module WebFinger
  class Response < ActiveSupport::HashWithIndifferentAccess
    [: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