Class: DistributedPress::V1::Social::Reference
- Inherits:
-
Object
- Object
- DistributedPress::V1::Social::Reference
- Extended by:
- Forwardable
- Defined in:
- lib/distributed_press/v1/social/reference.rb
Overview
A lazy loaded reference to a remote object that can access its attributes directly.
Constant Summary collapse
- PUBLIC =
Public addressing doesn’t lead to an activity
'https://www.w3.org/ns/activitystreams#Public'
Instance Attribute Summary collapse
- #dereferencer ⇒ DistributedPress::V1::Social::Dereferencer readonly
- #uri ⇒ String readonly
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(uri:, dereferencer:, object: nil) ⇒ Reference
constructor
A new instance of Reference.
- #inspect ⇒ Object
-
#object ⇒ HTTParty::Response
Fetches the remote object once.
Constructor Details
#initialize(uri:, dereferencer:, object: nil) ⇒ Reference
Returns a new instance of Reference.
25 26 27 28 29 |
# File 'lib/distributed_press/v1/social/reference.rb', line 25 def initialize(uri:, dereferencer:, object: nil) @object = object @uri = uri @dereferencer = dereferencer end |
Instance Attribute Details
#dereferencer ⇒ DistributedPress::V1::Social::Dereferencer (readonly)
20 21 22 |
# File 'lib/distributed_press/v1/social/reference.rb', line 20 def dereferencer @dereferencer end |
#uri ⇒ String (readonly)
17 18 19 |
# File 'lib/distributed_press/v1/social/reference.rb', line 17 def uri @uri end |
Instance Method Details
#==(other) ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/distributed_press/v1/social/reference.rb', line 31 def ==(other) case other when String then uri == other when Reference then uri == other.uri else false end end |
#inspect ⇒ Object
47 48 49 |
# File 'lib/distributed_press/v1/social/reference.rb', line 47 def inspect "#{self.class.name}(#{uri})" end |
#object ⇒ HTTParty::Response
Fetches the remote object once
43 44 45 |
# File 'lib/distributed_press/v1/social/reference.rb', line 43 def object @object ||= dereferencer.get(uri: uri) end |