Class: Roar::Representer::Feature::Hypermedia::Hyperlink

Inherits:
OpenStruct
  • Object
show all
Includes:
Enumerable
Defined in:
lib/roar/representer/feature/hypermedia.rb

Overview

An abstract hypermedia link with arbitrary attributes.

Instance Method Summary collapse

Instance Method Details

#each(*args, &block) ⇒ Object



161
162
163
# File 'lib/roar/representer/feature/hypermedia.rb', line 161

def each(*args, &block)
  marshal_dump.each(*args, &block)
end

#replace(hash) ⇒ Object

FIXME: do we need this method any longer?



166
167
168
169
170
# File 'lib/roar/representer/feature/hypermedia.rb', line 166

def replace(hash)
  # #marshal_load requires symbol keys: http://apidock.com/ruby/v1_9_3_125/OpenStruct/marshal_load
  marshal_load(hash.inject({}) { |h, (k,v)| h[k.to_sym] = v; h })
  self
end