Module: Hallon::Linkable
Overview
Note:
Linkable is part of Hallons’ private API. You probably do not not need to care about these methods.
Methods shared between objects that can be created from Spotify URIs, or can be turned into Spotify URIs.
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
-
.included(other) ⇒ Object
Will extend
other
with ClassMethods on inclusion.
Instance Method Summary collapse
-
#===(other) ⇒ Boolean
Compare the Linkable to other.
-
#to_str ⇒ String
Converts the Linkable first to a Link, and then that link to a String.
Class Method Details
.included(other) ⇒ Object
Will extend other
with ClassMethods on inclusion.
109 110 111 |
# File 'lib/hallon/linkable.rb', line 109 def self.included(other) other.extend ClassMethods end |
Instance Method Details
#===(other) ⇒ Boolean
Compare the Linkable to other. If other is a Linkable, also
compare their to_link
if necessary.
128 129 130 131 132 |
# File 'lib/hallon/linkable.rb', line 128 def ===(other) super or if other.respond_to?(:to_link) to_link == other.to_link end end |
#to_str ⇒ String
Note:
Returns an empty string if the #to_link call fails.
Converts the Linkable first to a Link, and then that link to a String.
117 118 119 120 121 |
# File 'lib/hallon/linkable.rb', line 117 def to_str link = to_link link &&= link.to_str link.to_s end |