Sha256: fbf368c97844ff16e71d33b2548414f327997a5e69952d7652a4a1275a6576e5
Contents?: true
Size: 760 Bytes
Versions: 17
Compression:
Stored size: 760 Bytes
Contents
Dir[File.dirname(__FILE__) + '/concerns/proxy/*.rb'].each { |file| require file } # Proxy makes different kind of data accessible # If href is present it also alows loading/reloading class LHS::Proxy include Accessors include Create include Link # prevent clashing with attributes of underlying data attr_accessor :_data, :_loaded def initialize(data) self._data = data self._loaded = false end def load!(options = nil) return self if _loaded reload!(options) end def reload!(options = nil) raise 'No href found' unless _data.href options = {} if options.blank? data = _data.class.request(options.merge(url: _data.href, method: :get)) _data.merge_raw!(data) self._loaded = true self end end
Version data entries
17 entries across 17 versions & 1 rubygems