class Sawyer::Relation::Map
Public Class Methods
new()
click to toggle source
Tracks the available next actions for a resource, and issues requests for them.
# File lib/sawyer/relation.rb, line 6 def initialize @map = {} end
Public Instance Methods
<<(rel)
click to toggle source
[](key)
click to toggle source
inspect()
click to toggle source
# File lib/sawyer/relation.rb, line 49 def inspect hash = to_hash hash.respond_to?(:pretty_inspect) ? hash.pretty_inspect : hash.inspect end
keys()
click to toggle source
Gets a list of the Relation names.
Returns an Array of Symbols in no specific order.
# File lib/sawyer/relation.rb, line 38 def keys @map.keys end
size()
click to toggle source
Gets the number of mapped Relations.
Returns an Integer.
# File lib/sawyer/relation.rb, line 31 def size @map.size end
to_hash()
click to toggle source
# File lib/sawyer/relation.rb, line 41 def to_hash pairs = @map.map do |k, v| [(k.to_s + "_url").to_sym, v.href] end Hash[pairs] end
Also aliased as: to_h