Module: Pupa::Concerns::Linkable
- Extended by:
- ActiveSupport::Concern
- Included in:
- Membership, Organization, Person, Post
- Defined in:
- lib/pupa/models/concerns/linkable.rb
Overview
Adds the Popolo links
property to a model.
Instance Method Summary collapse
-
#add_link(url, note: nil) ⇒ Object
Adds a URL.
- #initialize(*args) ⇒ Object
-
#links=(links) ⇒ Object
Sets the links.
Instance Method Details
#add_link(url, note: nil) ⇒ Object
Adds a URL.
28 29 30 31 32 33 34 35 36 |
# File 'lib/pupa/models/concerns/linkable.rb', line 28 def add_link(url, note: nil) data = {url: url} if note data[:note] = note end if url.present? @links << data end end |
#initialize(*args) ⇒ Object
12 13 14 15 |
# File 'lib/pupa/models/concerns/linkable.rb', line 12 def initialize(*args) @links = [] super end |
#links=(links) ⇒ Object
Sets the links.
20 21 22 |
# File 'lib/pupa/models/concerns/linkable.rb', line 20 def links=(links) @links = symbolize_keys(links) end |