Class: Decidim::ContentParsers::ProposalParser
- Inherits:
-
ResourceParser
- Object
- ResourceParser
- Decidim::ContentParsers::ProposalParser
- Defined in:
- decidim-proposals/lib/decidim/content_parsers/proposal_parser.rb
Overview
A parser that searches mentions of Proposals in content.
This parser accepts two ways for linking Proposals.
-
Using a standard url starting with http or https.
-
With a word starting with ‘~` and digits afterwards will be considered a possible mentioned proposal.
For example ‘~1234`, but no `~ 1234`.
Also fills a ‘Metadata#linked_proposals` attribute.
Defined Under Namespace
Classes: Metadata
Instance Attribute Summary collapse
-
#metadata ⇒ Metadata
readonly
abstract
Collects and returns metadata.
Instance Method Summary collapse
-
#initialize(content, context) ⇒ ProposalParser
constructor
A new instance of ProposalParser.
Constructor Details
#initialize(content, context) ⇒ ProposalParser
Returns a new instance of ProposalParser.
22 23 24 25 |
# File 'decidim-proposals/lib/decidim/content_parsers/proposal_parser.rb', line 22 def initialize(content, context) super @metadata = Metadata.new([]) end |
Instance Attribute Details
#metadata ⇒ Metadata (readonly)
This method is abstract.
Subclass is expected to implement it
Collects and returns metadata. This metadata is accessible at parsing time so it can be acted upon (sending emails to the users) or maybe even stored at the DB for later consultation.
28 29 30 |
# File 'decidim-proposals/lib/decidim/content_parsers/proposal_parser.rb', line 28 def @metadata end |