Sha256: 0dddbd5a94778122faa1cfded2ea292466ee4420578835209639f077ade6b815
Contents?: true
Size: 765 Bytes
Versions: 1
Compression:
Stored size: 765 Bytes
Contents
module Yaks class Resource include Equalizer.new(:type, :links, :attributes, :subresources) include Enumerable attr_reader :type, :attributes, :links, :subresources def initialize(options) @type = options.fetch(:type, nil) @attributes = options.fetch(:attributes, {}) @links = options.fetch(:links, []) @subresources = options.fetch(:subresources, {}) end def [](attr) attributes[attr] end # def type # end def each return to_enum unless block_given? yield self end def self_link links.find do |link| link.rel.equal? :self end end def collection? false end def null_resource? false end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
yaks-0.4.2 | lib/yaks/resource.rb |